LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Show waveform graph with previous data

Solved!
Go to solution

Hi, I'm trying to display my waveform graph with my previous data. Once I hit the run button, I lose the previous data. I want to be the data "stacked" on the same waveform graph.

 

For now, the first time I hit the run button, I get

hobbes8000_0-1673606912820.png

 

For the second time I hit the run button, I get

hobbes8000_1-1673606964717.png

 

So what I want is when I hit the run button, these data to be together in the same waveform graph.

 

I would be very thankfull for a specific code.

I will also attach my code.

 

Thank you

Yoo

 

 

0 Kudos
Message 1 of 6
(1,216 Views)
Solution
Accepted by hobbes8000

Use a feedback node:

Basjong53_1-1673608007894.png

 

Use 'build array' instead if you want to overlap instead of append

Message 2 of 6
(1,206 Views)

With a Graph (as opposed to a Chart), you "draw the entire Graph all-at-once".  Generally, graphs are "static", charts are "dynamic" (you basically plot only the "new" points).

 

To do what you want to do, you can do the following:

  1. Gather your first Waveform (say, 600 points).  Plot it on a Graph, and save the Waveform.
  2. Gather your "next" Waveform (another 600 point).  Do a Build Array with Waveform 1.  Plot the Graph.

Oops -- the Graph can accept either a Waveform or an Array of Waveforms.  So, try again (I'm doing this "in my head" as I write this ...)

  1. Gather your first Waveform.  Pass it to Build Array, to create an Array of Waveforms with a single Array.  Plot the Graph.
  2. Gather your next Waveform.  Append Array and plot the Graph.
  3. Continue as needed.  Each time, you are replotting all of the points, and your Plot Legends, Line Types, Colors, etc. might need to be "adjusted".  This is not (I believe) how LabVIEW Graphs and Charts were designed, but it can (potentially) work ...

Bob Schor

 

P.S. -- I really should write a little test routine to see if this works, but I'll let my colleagues on the Forum take pot-shots at it ...

 

Message 3 of 6
(1,184 Views)

As a first step, you probably should go back to the tutorials. Currently, your VI is a "one shot downhill" deal because it does not even have a toplevel while loop. You should have a simple state machine. (I really hope you are not using the "continuous run" button to operate this!!!)

 

Also think about the problem. If you would append new data forever, you'll eventually run out of memory (OTOH, a chart has a limited history length, discarding the oldest data).

 

Why is there So. Much. Duplicate. Code????

 

For example the following could be replaced by a singe FOR loop autoindexing on arrays of waits and booleans. NO need for locals or sequences! Your current code does not guarantee synchronicity between the various "trains". Shouldn't there also be some synchronization between the upper and lower code islands?

 

altenbach_0-1673624399082.png

 

Message 4 of 6
(1,174 Views)

Thanks everyone for the reply. Everyone helped. I'm now getting in to labview so, my codes are kind of inefficient. I'm working on to imporve it.

 

Thanks again

Yoo

0 Kudos
Message 5 of 6
(1,103 Views)

It worked! I got exactly what I wanted using the feedback node + build array.

Thanks a lot!

 

Yoo

0 Kudos
Message 6 of 6
(1,102 Views)