LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

dynamic channels to plot

Hi everyone,

 

I have created a program where a user can select the number of  channels to monitor (1 to 40 channels).  Is there a way to plot the number of channels selected by the user? 

 

I am most familiar using merge signals with a waveform chart.  I need to plot the measured voltage over time.  This method has always worked for me, but the problem is that I don't know know how many channels will be selected.

 

Any suggestions?

 

Thanks.

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

Dynamic signals are a great way to "hide the details" and make it easy to do simple things.  Unfortunately, by obscuring the details, doing something as simple as using a For loop to create an Array of Waveforms (or an Array of 1D Arrays, i.e. a 2D array) which will give you the plot that you want is much harder.

 

I notice that you didn't share any code, so I won't, either (as it might be way "off topic" and not helpful).  Try removing the Dynamic Wire (use "From DDT" -- a great name, read "Silent Spring" to see why DDT was banned for many years) and see if the solution "writes itself" for you (following my comments, above).

 

Bob Schor

0 Kudos
Message 2 of 5
(3,053 Views)

Thanks for getting back to me, Bob.

 

I can share some more details.

 

I have 40 buttons that a user can select to monitor channels.  In my code, there is a value which represents the number of channels selected.  Like I said, I am most familiar with merge signal and waveforms to plot values over time which is what I still need to do.  However, I don't know how to use the merge signal if I don't know in advance how many signals were selected.  

 

I am newish to Labview, and I am working on keeping my code clean and efficient.  I attached a mini example of what I am trying not to do.  I only have two case structures, but if I keep going this way, I would have up to 40!  This would be a subvi where the array is the data measured.

0 Kudos
Message 3 of 5
(3,045 Views)

Natalie,

 

     Let's assume that you have Multi-Channel Data, arranged as a 2D Array of Dbls, with each row representing one Channel, and the columns representing the N Data Points (per channel) that you wish to plot.

 

     Let's also assume you have an Array of the Channels you want to plot (e.g. [0, 2, 4, 6, 7] plots Channels 0, 2, 4, 6, and 7).  Here's the code (brief explanation to follow) that does this.  [I apologize for using a LabVIEW 2015 Snippet, but this is so simple you should be able to re-create it on your LabVIEW 2013 system].

 

Plot Selected Channels.png

So you use the For loop to pick out the rows you want to plot, creating a 2D array where Rows = Channels and Columns = Points.  By default, Waveform Charts plot Rows = Points and Columns = Channels, so I do a Transpose before plotting.  Note that you can also set up the Waveform Chart to do the Transpose "inside" it.

 

Bob Schor

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

The Express palette has an Express VI called Select Signals.  You can wire in an array of booleans that will select the channels.  It turns the array into another DDT wire.

 

I don't recommend express VI's or adding more blue DDT wires.  But it does what you ask for without a whole lot of code on the block diagram.  (It just buries the code in the blue VI's and the data in the blue wires.)

0 Kudos
Message 5 of 5
(3,007 Views)