The For Loop is one of the most widely used tools in Labview. However, it has a drawback. The step size and starting point is fixed and cannot be changed. Most of the times this is OK. But there comes a time when being able to change the starting index and/or the step size would become very useful. Consider the following scenario:
You have a test results file as such:
Test1 UUT1 3.4
Test2 UUT1 4.5
Test3 UUT1 5.4
Test1 UUT2 3.0
Test2 UUT2 4.1
Test3 UUT2 5.2
Lets say you wish to extract all the info for Test2 only.
With a conventional For Loop, you would have to create special code to form the index. You could do it with a While Loop:
Or you could have an option to specify the start, stop, and step parameters:
This could be made possible as a right click option. The default would be for the For loop to appear and function as it is now. But if you right click on the border, you would get an option to display and use the extra terminals, as shown below. This is similar to what is being done with the Conditional terminal.
With this option, the three values would be supplied. The i terminal value would follow the parameters. With a start value of 1 and a step size of 2 and a stop value of 10, the i for each iteration would be 1,3,5,7,9.
This would also apply to auto indexing when this option is chosen. In the above test result example. the code could be made even simpler by enabling indexing:
If the start were set to 1, step to 3, and stop to 5 (or the length of the array - 1), the output would be rows 1 and 4. No extra code needed.
I think this idea has great merits. It allows use for special cases, and it allows the normal For Loop to be continued as it is today, making it backward compatible.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.