LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Extracting data from a single iteration

Hello everybody,

 

is there a way to extract data from a specific iteration of a for loop? I am currently using a for loop with 17 iterations to take some measurements. The first iteration does a calibration measurement, while the remaining 16 do the actual measurement. Now I wold like to extract the calibraion measurement after the first iteration and then plot it against each of the subsequents measurements on an XY-graph. Is this possible?

 

Thanks in advance.


Christian

0 Kudos
Message 1 of 9
(4,047 Views)

@christianwos wrote:

Hello everybody,

 

is there a way to extract data from a specific iteration of a for loop? I am currently using a for loop with 17 iterations to take some measurements. The first iteration does a calibration measurement, while the remaining 16 do the actual measurement. Now I wold like to extract the calibraion measurement after the first iteration and then plot it against each of the subsequents measurements on an XY-graph. Is this possible?

 

Thanks in advance.


Christian


What does your VI look like now?

0 Kudos
Message 2 of 9
(4,031 Views)

The for loop I am talking about is the one in the 5th frame. I hope it is not too messy to understand.

0 Kudos
Message 3 of 9
(4,028 Views)

Christian,

 

Do you need to plot while the loop is running or only after it ends? For the plot after the loop ends just autoindex all the data into an array. After the loop stops, use Array Subset or Split Array to separate the data. To plot while the loop is running you will need a case structure to distinguish the calibration run from the others. Place the calibration data in a shift register so that it is accessible to subsequent iterations.

 

Lynn

Message 4 of 9
(4,025 Views)

Hi Lynn,

 

Thank you for your suggestion. Should I place the shift register in the for loop?


Christian

0 Kudos
Message 5 of 9
(4,021 Views)

Now that I have seen your VI it is clear that you have bigger problems than calibration. Have you attempted something for the calibration? I do not see anything which looks like you have done so.

 

General comments:

- Keep the size of the diagram to one screen. Scrolling around to see all the code makes it very difficult to follow what the code does.

- Avoid the use of sequence structures. With rare exceptions (such as your Start Time and Stop Time nodes they are almost never appopriate. They defeat the LabVIEW dataflow paradigm. Stacked sequence structures obscure code and force right to left wiring when sequence locals are used.

- Avoid the use of the STOP function. It is equivalent to pressing the Abort button. One long time Forum participant has said: "Using Abort [or STOP] to stop a VI is like using a tree to stop a car. It works but there may be unintended consequences!" In particular it can leave DAQ devices in unknown states, files open, and communications ports open.

- By placing all the control terminals outside the sequence structure only the values present when the VI starts running will be used. Any changes later will not be read until the program stops and is started again.

 

Solution to most of these: Look at the State Machine Design Pattern.

 

Lynn

Message 6 of 9
(4,011 Views)

Thank you for your suggestions.

0 Kudos
Message 7 of 9
(4,006 Views)

index.jpg  My eyes!!!!!  index.jpg

 

Haha.  Definitely check out the design pattern examples.  Your scrollbars will thank you.

 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 8 of 9
(3,993 Views)

People,

 

There is no need to make fun of me. I started working with LAB view three weeks ago.

 

Thanks for all your comments anyways.

 

0 Kudos
Message 9 of 9
(3,958 Views)