cancelar
Mostrando los resultados de 
Buscar en lugar de 
Quiere decir: 

Do U have a simple and intelligent solution for this problem? Logical problem...

I must to do a cycle with this features:
- I have a random number, N(i), for 100, so I have a number between 0 and 100 generated every step of cycle;
- every number is pass to shift register of cycle;
- I have also a number X initialized at 50;
- I start with sum or subtract 1 from 50 in the first step (i=0) of cycle (for example I subtract 1: X(0)=50-1=49);
- I compare two subsequently number N(1) and N(0): if N(1)<N(0) I desire that the next step of cycle continue to subtract 1 from X(1), for example X(1)=49-1=48, instead, if N(1)>N(0) I want change the operation on X. Since the first is - the new operation is + (for example X(1)=49+1=50). Pratically I desire a SWITCH that if N(i)<N(i-1) don't change previous operation on X(i), if N(i)>N(i-1) change operation on X(i).
Can I do it?
0 kudos
Mensaje 1 de 15
3.534 Vistas
Yes.  You just need to have another shift register that is a boolean to store whether you are in a count up or count down cycle.
0 kudos
Mensaje 2 de 15
3.525 Vistas
 Please do... and post VI. Thanks.
0 kudos
Mensaje 3 de 15
3.522 Vistas
Try to check if this is what you need.
---

While evaluating my code please have in mind that I am a LV novice. Therefore sometimes my code might violate some coding rules that I have to learn about myself. But how else could I do that... 🙂

Chart zoom with "Mouse Over" effect
0 kudos
Mensaje 4 de 15
3.508 Vistas
Not very good... I hope excellent solution 😉
0 kudos
Mensaje 5 de 15
3.500 Vistas

What was wrong with the solution Giedrius gave you?

 

Why not try to work this out yourself and post a VI with any questions you might have if your attempt doesn't work right.

 

Is this homework?  Emoticono loco

0 kudos
Mensaje 6 de 15
3.495 Vistas
Absolutely no, please save it for previous version of LabView. I don't have LW9.
0 kudos
Mensaje 7 de 15
3.491 Vistas

What version do you have?
0 kudos
Mensaje 8 de 15
3.489 Vistas
LW8
0 kudos
Mensaje 9 de 15
3.487 Vistas

The only (possible; it depends on what exactly do you need) problem I see in my previous VI is that it is static. I mean, then you have the < as the outcome of the comparison, it substracts, and if you have > - it sums. This vi checks for the previous operation, maybe it is more correct according to what you need.

 

P.S. Both previous and this VI are coded using LV 8.6. What version do you need?

Message Edited by Giedrius.S on 02-20-2010 12:21 AM
Message Edited by Giedrius.S on 02-20-2010 12:25 AM
---

While evaluating my code please have in mind that I am a LV novice. Therefore sometimes my code might violate some coding rules that I have to learn about myself. But how else could I do that... 🙂

Chart zoom with "Mouse Over" effect
Descargar todos
0 kudos
Mensaje 10 de 15
3.484 Vistas