05-28-2012 06:53 AM
05-28-2012
06:57 AM
- last edited on
01-21-2025
05:31 PM
by
Content Cleaner
You can add a conditional terminal to configure a For Loop to stop when a condition occurs. A For Loop with a conditional terminal executes until the condition occurs or until all iterations complete, whichever happens first. For example, if you want a loop to execute a set number of times unless an error occurs, you can use a For Loop with a conditional terminal and wire an error cluster to the conditional terminal.
If you wire the conditional terminal in a For Loop, you cannot predetermine the number of iterations the loop executes. You can determine the number of iterations the loop completes by auto-indexing an output array and checking the number of elements after the loop executes or by wiring an indicator to the loop iteration terminal and checking the count after the loop executes.The number wired to the count terminal or the number of elements in the auto-indexed input array acts as the maximum number of loop iterations that complete if the condition wired to the conditional terminal never occurs. If you want a loop to iterate until a condition occurs with no maximum number of iterations, use a While Loop instead.
If the conditional terminal of a While Loop, a For Loop, or a (Windows, ETS, Vxworks) Timed Loop is Continue if True , the loop executes its subdiagram until the conditional terminal receives a FALSE value. If the conditional terminal is Stop if True
, the loop executes its subdiagram until the conditional terminal receives a TRUE value.
05-28-2012 07:04 AM
Hi alecjcook,
Is your 'Stop control' is type def ??
Regards,
Bijay
05-28-2012 07:07 AM
So why does it have a coersion dot on it?
05-28-2012 07:08 AM
Yes my 'Stop control' is type def
05-28-2012 07:08 AM
I am with the expectation of being the boolean control being a typedef. From LabVIEW 2011 on, the block diagram makes us easily see if the control is a typedef. So I guess you are not using LabVIEW 2011.
05-28-2012 07:12 AM
No, its LV2010.
So why is there a coersion dot? the data type of this custom control is still boolean, it can still only be TRUE or FALSE, so what is being coerced?
05-28-2012 07:15 AM
The coercion is done from typedef'd to non-typedef'd. No reason to care: LabVIEW just tells you that the data types do not match exactly.
05-28-2012 07:15 AM - edited 05-28-2012 07:18 AM
It is almost impossible to avoid coercion dots in the latest versions of LabVIEW as a typedef is now viewed as different than its underlying type.They also alert you that your chose datatype may not be optimal or appropriate for a certain function.It is always best to avoid coercions/conversions. Choose a proper data type from the beginning if at all possible.
see this thread: http://forums.ni.com/t5/LabVIEW/Coercion-dots-Typedef-and-Property-Nodes/td-p/1507442
05-28-2012 07:22 AM
@danil33 wrote:
[...].It is always best to avoid coercions/conversions. [...]
I do not agree. As long as no buffer allocation takes place, I do not concern about coercion dots. See e.g. are typedef coercion dots bad for efficiency