LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

For loop that does not start at 0.

Hi, I would like to create a "For loop" that does not start with "i" = 0 but with a negative value as I have a time domain signal that starts with a negative value for the time t. Do you know how I could do that?

Best,
Ninskaya
0 Kudos
Message 1 of 5
(6,045 Views)
Instead of using the iteration terminal, use a shift register intialized to whatever value you want.
0 Kudos
Message 2 of 5
(6,045 Views)
Great! Thanks a lot.
Best,
Ninskaya
0 Kudos
Message 3 of 5
(6,045 Views)
Simply subtract the desired number from the iteration terminal [i] before feeding the resulting number to the rest of the code.
(... or, in your particular case, simply use a negative xIncrement value, right? No code change needed).

May I ask why you use extended precision for xIncrement? This does not seem necessary. I would also strongly suggest to use standard naming convention (as e.g. used by graph axes). You use increment as "offset", while by convention increment is the spacing between adjacent points and thus should be multiplied with [i]. I have attached a simple example how I would do all this.

Of course I don't know the purpose of your code and the rest of your program, but if you are just trying to create x-values for an xy graph, non
e of this is even needed. It might be much easier to use a plain waveform graph and simply set the x-axis offset and multiplier accordingly. Let me know if you have questions.
0 Kudos
Message 4 of 5
(6,045 Views)
Thanks a lot!
Best,
Ninskaya
0 Kudos
Message 5 of 5
(6,045 Views)