02-23-2015 02:07 PM - edited 02-23-2015 02:09 PM
This is a bit subtle, so I apologize in advance for the possible confusion.
Start with a While Loop and conditionally autoindex a scalar:
Example 1
As indicated, the boolean output is a scalar.
Now try the same with a For Loop (DO NOT REPLACE THE WHILE LOOP above by a For Loop. CREATE A BRAND NEW FOR LOOP):
Example 2
OK, so now, the boolean output is an array. Cool, that's what I wanted with the While Loop above, but was unable to achieve.
Now you can play with replacements:
In Example 1 above, replace the While Loop by a For Loop. Here is what you'll get:
So you CAN output a scalar Boolean in a For Loop, but you have to go through a While Loop to obtain this.
Now replace the For Loop in Example 2 by a while Loop:
Alright, here is my Boolean array output. But I had to go through a While Loop to do so.
I'd say this is a bug and the conditional indexing boolean output should be an Array (not sure whether there would be any point to have it be a scalar; last value output?).
Tested in LavBIEW 2013 SP1 64 bit
Solved! Go to Solution.
02-23-2015 02:27 PM
My guess for the reasoning for this is that the default of a for loop is to index the outputs whereas for a while loop it is an index? To be honest, I can't say I'd noticed that there was any sort of output on the conditional terminal...
(I guess the bug is that it should either always be an array or you should be able to right click on it to disable indexing?)
02-23-2015 03:09 PM
Sam is correct: the conditional terminal is not an output of the for loop. When you "dragged it through" to the sequence you were actually creating a (non-conditional) indexing boolean array output. Click "diagram cleanup" and you'll see this. (I suppose it could be a bug that LabView allows the two nodes to stack on the same place on the loop.)
By the way, you can always output a scalar from a for loop. Right click on the tunnel, set it to "last value".
02-23-2015 03:12 PM
Darn! I never use the Diagram cleaning tool and indeed, I had been a bit puzzled about the way the marching ants where drawn when I was trying to pull a wire from the Boolean "output" (which isn't one, as we now agree).
02-24-2015 02:30 AM
Now, if only LabVIEW was more vigilant about overlapping stuff...
And you wanna know the real irony of that whole story? I actually already posted the same idea before and forgot about it.
Well, at least I can see that both I and the rest of the community are fairly consistent.
02-24-2015 10:06 AM
I knew that was coming. I was thinking the same way, except that I am a big "overlapper" myself...
In that specific instance, I would be ready to live with the rule that no shift register or any gizmo living on the edge of a structure can hide a wire (or any other thing for that matter). Just leave me the rest of the diagram to hide stuff wherever I wish.