LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

auto start and stop while loop by using number

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

0 Kudos
Message 1 of 4
(2,755 Views)

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…)

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(2,729 Views)

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

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 4
(2,720 Views)

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.

0 Kudos
Message 4 of 4
(2,686 Views)