01-27-2017 01:42 AM
I need help, I want to create a simple program using labview. start and stop the while loop using numbers as it control.
Example
I want to use the number 2 as a control.
I have random numbers
2,4,5,3,2,1,2,8,2,
paragraph 2, which first appeared as a start control
and number 2 that appears fourth as stop control
01-27-2017 02:15 AM
Hi andriawan,
your description is quite "vague" (AKA "I don't understand your requirements")…
- Please show a flow chart of your task - it's a standard way to give an overview of algorithms.
- In LabVIEW you start a WHILE loop by entering it using DATAFLOW.
- In LabVIEW you stop a WHILE loop by providing a stop condition and executing the WHILE loop content using DATAFLOW.
I want to use the number 2 as a control.
Please explain this!
The way you described it it seems to me "2" is a constant. How can a constant be a control? (You can use constants for comparison with control values to generate conditions…)
01-27-2017 02:43 AM
Do you want the 1st and 4th number to be some sort of control code, or just the number 2?
In either case you'll need a String to array, and then either a Index array or 2 Search 1D-array (where the 2nd starts at the index found by the 1st).
/Y
01-27-2017 02:34 PM
Hi andriawan,
Start in the block diagram by placing a while loop and 2 constant, the constant outside the while loop.
Drop the "Equal?" node, that would be on the comparison pallette, and conect the right terminal to the while stop button.
Next, connect the 2 constant to one of the left terminals of the Equal? node.
Now lets get with the other terminal.
Start by placing Random Number (0-1) and multiply it by 10. Connect the result to Round to Nearest and connect Round to Nearest to the free terminal of the Equal? node.
Hope that helps. Let me know if I lost in a step or the results aren't the ones you wanted.