LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Move plotting to inside a while-loop

Hi I have a plot that occurs outside a whileloop, and another that is constructed inside the whileloop.

 

How do I get the plots to run synchronously in the same waveform chart?

 

I've tried looptunnels, I've tried shiftregisters but neither solves it.

Below is a picture of my attempt to get'em together.

 

This doesn't work.png

 

Hoping for some help.

Kindest regards,

Lasse

 

0 Kudos
Message 1 of 5
(3,443 Views)

Just to clarify, you're defining a complete waveform and starting to write it outside of the while loop.

Then, while waiting for the write to complete, you acquire another signal asynchronously in chunks, adding data to the chart a chunck at a time.

 

Because you are using a chart (as opposed to a graph) your complete write waveform will added each iteration to the chart indicator.

 

(I'm compiling an installer at the moment so I can't provide a snippet to demonstrate right now. Give me another 20mins and I'll post again.)

 

What you could do first of all is use a waveform graph instead of a chart.

Then using a 'build array' on the 'Y' values, manually build the waveform of acquired data in a shift register and display it in your chart indicator.

 

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 2 of 5
(3,424 Views)

This should do what you requested, but it will keep adding data until you hit stop or memory is full.

You'd have to add some sort of data truncate function to limit how much history is displayed.

 

(The hidden case is 0, it adds the first acquired chunck of data to the shift register)

 

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
Message 3 of 5
(3,411 Views)

Dear Troy, could you explain your code a little bit?

 

- Where do you find the empty waveform? I found waveformconstant is it OK?

-Why do you index the case-statement for each while-loop iteration?

 

I am using Get waveform Components, Build Array and Build Waveform, but my Build array vi doesn't look the same as yours.

Lokk what I get:

Dimension two of array.png

 

Thanks again.

0 Kudos
Message 4 of 5
(3,387 Views)

Waveform Constant is what I used, I just named it empty waveform so you knew it was empty.

 

I used the iteration terminal of the for loop as an input into the case structure because the first time it runs (case 0) will just grab the whole waveform and put it in the shift register. That way it gets the timestamp and dt values, then every iteration after that just builds on the Y array.

 

The broken wire is because your build array han't been set to 'concatenate'.

Right click on the 'build array' primitive and set it to concatenate.

Otherwise it builds a 2D array instead of a adding the two 1D arrays together.

 

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 5 of 5
(3,369 Views)