LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Keep the previous graph when you start a new measure cycle

Hi guys, I need help with this. My task is to make a measure cycle and plot the graph, but if I start a new cycle i need to keep the previuos graph on the display while the new one is being buil. How can modify this VI to attemp this task?

0 Kudos
Message 1 of 10
(175 Views)

Please do a "save for previous" (e.g. 2019) and attach again so more can look at your VI.

 

  • What's the datatype (Array, waveform, dynamic, etc.)?
  • Are all cycles of the same length?
  • Is there a known upper limit on the number of cycles?

 

0 Kudos
Message 2 of 10
(166 Views)

Hello, Isabella.

 

     If you want to plot not only the current XY values of, say, Voltage vs Current, you build (as you have done) an Array of the X values and an Array of the Y values and combine them in a Cluster and send them to the XY Graph ("XY Graph (V-I)").  If you also want the previous XY values to be plotted (perhaps in a different color, or line style), you need to create another Array of "previous" X and "previous" Y, combine in a Cluster, and plot an Array consisting of the "current" and "previous" Clusters.

 

     But what if you don't want to see all of the "previous" data points?  Simply set the Y values that you don't want to see to the value "NaN" (which stands for "Not a Number").

 

Bob Schor

0 Kudos
Message 3 of 10
(99 Views)

Hi, I'm new to the community. What does it means a "save for previous"? Anyway I'm working with a SMU Keithley 236 and I must do variuos measure cycles. I want that the previous curve remain in the display when I started a new cycle and a new curve is building. In input I have two arrays that that update in real time with the measurements. And I don't think the measure cycles will have the same lenght

 

0 Kudos
Message 4 of 10
(93 Views)

Thank you but how can I make it this actually? I have source array and measure array that update in real time. How can I store the previous values in a new array? I thought about using shift register to store the curve but I don't know

0 Kudos
Message 5 of 10
(92 Views)

Hello, Isabella.

 

     Many "new users" of the LabVIEW Forum are students who are running the "very latest" versions (like LabVIEW 2025 Q3), while we "old timers" (or, more kindly, "long term users") only upgrade ever 2-4 years.  Since a VI saved in, say, LabVIEW 2025, cannot be opened by someone using LabVIEW 2022, we can't "look at your code" unless you "Save for Previous Version".  To do this, go to the File button on your VI screen and click "Save for Previous Version".  You'll see a list of earlier versions of LabVIEW, so choose something 2-4 versions earlier.

 

     We used to suggest 2019 or 2021, but with Windows 11 coming, LabVIEW 2022 might be the "new best Save for Previous" choice.  However, @altenbach has been around longer than I, so you could also follow his suggestion of 2019 ...

 

Bob Schor

0 Kudos
Message 6 of 10
(84 Views)
0 Kudos
Message 7 of 10
(78 Views)

Hello, again, Isabella.  This is a response to your Message 5 (a few back) in this string.

 

How do you show "the current evolving X-Y Graph" and the previous "X-Y Graph"?  Before we do this, I need to ask how you are treating "the current evolving X-Y Graph"?

 

Consider an Oscilloscope looking at your data.  It can operate in (at least) two modes.  One is a slow "Sweep" mode where the beam moves slowly left-to-right, and when it gets to the end, it starts over erasing the "old" point and putting in a "new" point (so you can follow the "discontinuity" in the beam to know where "now" is.  The other is a triggered "single sweep" mode, where the beam zips across when triggered, writing a single sweep that stays on the screen until another trigger causes another sweep to appear.

 

If you want to see both a "Current Sweep" and a "Previous Sweep" on the same XY Graph, then you need to have data for both the current "evolving" (slow "Sweep" or fast "Triggered") Graph data and the previously plotted Graph data.

 

When you start your program, both Current Sweep and Previous Sweep will be empty Arrays.  Your LabVIEW program will fill the Current Sweep, and you'll plot both Current and Previous (which will be initially empty, hence "invisible").  When you finish the Current Sweep, you'll copy its data to the "Previous Sweep" array, and start filling Current Sweep again (you might want to first re-initialize Current Sweep to an empty Array, as you'll see the "old data" in the Previous Sweep plot (which I recommend you distinguish by changing the properties of the Graph, such as using a dotted instead of a solid line, using a thin instead of a thick line, using Red instead of Green).

 

Bob Schor

Message 8 of 10
(64 Views)

There is a lot of code smell, for example none of your local variables should exist, because once the loop starts, they can never change. Just branch from the wire before the loop.

 

It is not clear when one measurement ends and the next one starts. Are you stopping the VI and restart it from scratch? A better way would be a proper state machine.

 

In your case, you simply need an uninitialized shift register, where you retain previous runs and keep an array of plots.

 

0 Kudos
Message 9 of 10
(49 Views)

See if this can give you some ideas....

 

 

 

0 Kudos
Message 10 of 10
(41 Views)