LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple plots in a single Waveform

Solved!
Go to solution

Hi all, I want to plot multiple plots in a single waveform.

 

Overview:

First, I select model (1 or 0), it is the input for case structure.

in the case structure depending on the input (model select) the waveform should plot the readings.

for 1 it is 5 plots. 

for 0 case it is 3 plots.

 

I tried it is showing some error.

 

Don't worry about the controls I have placed I am reading data from different instrument so it will always change.

 

 

0 Kudos
Message 1 of 6
(437 Views)

Not sure why you use a local variable if you could just wire to the terminal. Cluster are fixed size and you can either make it large enough and don't use some of the input or use a 2D array instead.

The chart data type gets defined by what is wired to the terminal. Wiring to a local cannot do change that for good reason.

 

Your case should be an integer, of course.

 

(Posting by phone, cannot look at your VI)

0 Kudos
Message 2 of 6
(420 Views)

I could wire it directly to the terminal. What about other case. it will show conflict error.

 

(I understand)

0 Kudos
Message 3 of 6
(404 Views)

As I said, I can't look at your vi, but the clusters must match in type. I still recommend to go with a 2D array instead.

0 Kudos
Message 4 of 6
(396 Views)

The error is because the waveform chart is expecting a 3 element cluster for case 5 and you are trying to wire a 5 element cluster on case 1. 

One work around solution is to plot a 5 element cluster on both cases, but add NaN on the 4th and 5th element . THis way the Waveforme Chart can be wired to both cases without the need of local variable, if you leave them (the inputs) outside of the case, you can eliminate the 3 local variables as well. 

I created a  waveform chart 2 that is wired to 5 element cluster 

LVNinja_1-1733496233084.png

 

 

0 Kudos
Message 5 of 6
(368 Views)
Solution
Accepted by topic author Basavaraj093

OK, I had a look at your VI and here's what you could do.

 

altenbach_0-1733501332324.png

 

 

  • No need for any local variables
  • use a radiobutton control for the selection (Makes the code self-documenting, no need for subdiagram labels!)
  • do not maximize the diagram to the screen
  • ...

The problem is that if you change the mode during the run you must clear the chart history because some assignments will change. Of course you need to change the plot legend and number of visible elements whenever the selector changes, which would be easy to implement. Another option would be to just always plot all five, but use NaN for the ones you don't use. This way the lines will remain correctly assigned even if you change mode during the run.

 

 

Message 6 of 6
(352 Views)