12-23-2012 01:05 PM
Dear LabVIEW experts 🙂
I would like to ask you for providing me an explanation of behavior of the very simple VI in attachment. This VI contains one WHILE loop with three input parameters FROM, TO and STEP. The RESULT array shows computed values. If we consider input parameters FROM = 0, TO = 1, STEP = 0.1, then RESULT array contains values 0, 0.1, 0.2, ......, 0.9, 1. If we consider input parameters FROM = 1, TO = 2, STEP = 0.1, then RESULT array contains values 1, 1.1, 1.2, ......, 1.8, 1.9. The question is, why the number 2 is missing? (I was also trying to use different data-types, but without success). Thank you for your thoughts.
Juraj
Solved! Go to Solution.
12-23-2012 01:40 PM - edited 12-23-2012 02:31 PM
Because you are comparing floating point numbers.
For example 0.1 cannot be exactly represented in binary, so repetitve additions will probably not end in an exact integer later.
From the three inputs you can calculate the number of values exactly, and use a FOR loop. Don't use convoluted code.... 😉
Why don't you simply use ramp pattern?
12-23-2012 01:53 PM - edited 12-23-2012 02:01 PM
Thanks, ramp pattern is exactly what I was looking for 🙂