From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
07-16-2015 02:49 AM
This may be an simple algorithm, but I can't do it.
I need to do a VI with an algorithm so similar to n=n+1 , but I need 2 variables, something like n=n+x, and other conditional variable (numerical control).
I need to enter the values n and x with a control and after the sustraction of these values but I need to print the value and after repit the process until the conditional value, and impress all the values incluiding the the first n value and the conditional value. And stop the process when the value is equal to the conditional value to get a data.
Basically
n=n+x
n=0
x=2
Conditional value (y)
y=10
and impress all the values in a data
n=0 (impress)
n=0+2 -->2 (impress)
n=2+2--->4 (impress)
n=4+2---->6 (impress)
n=6+2---->8 (impress)
n=8+2---->10 (impress)
And get a data like
0
2
4
6
8
10
The real problem is that I need enter with numerical controls all values and get the data with the n's first value and the conditional value.
If someone can help me, I appreciate it very much.
Thanks
07-16-2015 02:55 AM - edited 07-16-2015 02:56 AM
Hi Walter,
this sounds like you want to learn LabVIEW! To do so I recommend to take all those free online resources offered by NI (like www.learnni.com ).
Your task requires a WHILE loop, a shift register and a comparison node…
The next time you ask a question on a programming problem you have you should attach the VI you are currently working on. This way you will get better comments on how to improve your programming skill and style!
07-16-2015 06:52 AM
Walter_White wrote:
The real problem is that I need enter with numerical controls all values and get the data with the n's first value and the conditional value.
It would be a much bigger problem if you didn't have to do this. This is, by far, the easiest way to do what you're wanting to do. I'd take Gerd's advice and post what you've tried so far. With questions that sound like homework problems, people are much less likely to give you the answer and more likely to direct you to it so you learn in the process. This certainly sounds like a homework problem as it tests your understanding of shift registers, while loops, arrays, and subVIs.
07-16-2015 10:16 AM - edited 07-16-2015 10:23 AM
07-16-2015 10:23 AM
I'd be worried about that loop never stopping if no iteration of n+x is exactly y. You might want to replace the equals with greater than or equal.
07-16-2015 01:09 PM - edited 07-16-2015 01:10 PM
@ramktamu wrote:
This is what you are looking for.
Try to simplify according to these comments and re-post. 😄