LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Wiring 2d array of waveform elements to a chart

The Labview help page for charts says this:

 

You can use the waveform data type to create multiple plots on a waveform chart. Use the Build Waveform function to plot time on the x-axis of the chart and automatically use the correct interval between markers on the x-scale of the chart. A 1D array of waveforms that each specify t0 and a single-element Y array is useful for plotting data that is not evenly sampled because each data point has its own time stamp.

If you cannot determine the number of plots you want to display until run time, or you want to pass multiple points for multiple plots in a single update, wire a 2D array of numeric values or waveforms to the chart. By default, the waveform chart treats each column in the array as a single plot. Wire a 2D array data type to the chart, right-click the chart, and select Transpose Array from the shortcut menu to treat each row in the array as a single plot.

 

I am trying to pass multiple points for multiple plots using a 2d array of waveform data types, however when I wire the 2d array to the chart I get  broken wire and the message:

 

You have connected two arrays of different dimensions. The dimension of 2d waveform array is 2. The dimension of chart is 1.

 

Any ideas why the chart will not accept a 2d array of waveform elements?

0 Kudos
Message 1 of 9
(4,944 Views)

Post your code and we can help. Are you connecting directly to the graph or to a local varible or property node?

Tim
GHSP
0 Kudos
Message 2 of 9
(4,940 Views)

I think that might be an error in the way that part of the help file was written.

 

I know you can wire in a 1-D array of waveforms.  But what is the physical meaning of a 2-D array of waveforms?  A 2-D array of waveforms is not logical.

0 Kudos
Message 3 of 9
(4,935 Views)

@Ravens Fan wrote:

I think that might be an error in the way that part of the help file was written.

 

I know you can wire in a 1-D array of waveforms.  But what is the physical meaning of a 2-D array of waveforms?  A 2-D array of waveforms is not logical.



Well, it does make sense for passing in multiple points that are not sampled at equal time intervals to multiple plots. I now see that the easy fix is to wire the 2d array to a for loop to index the second dimension and update the chart in the loop.

 

Thanks for the replies.

0 Kudos
Message 4 of 9
(4,916 Views)

That help text is a little mis-leading because the first paragraph talks about the WF data type and the second moves to an array (non WF).

 

WF data type Charts are my weapon of choice in many of my applications so I can offer the following.

 

WHen you present an array of WF (1D) to the chart it interprets each element as a plot. If there are more than one value in the Y array the values are plotted by first using the t0 to figure out where the first value goes and the dt to determne the spacing from the first. If your data is coming in asycronuously (like when polling a serial widget) you can point a single value in the Y array and use the t0 to get non-perioc plotting of the data values.

 

A WF chart like other charts has a history. It is a 2D array that reflect was was presented to chart in the order it was presented.

 

So to update a chart from a 2D array you have to aplly the update one at a time and that is what you found when you saw the warning error message.

 

So the For loop is a correct answer.

 

Generally speaking...

 

I like the WF Chart because;

Non-periodic ploting of points.

Automatic plot naming.

Automatic clearing when appropriate.

 

Have fun!

 

Ben

 

Saverio,

 

Agree the help is misleading. See above.

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 9
(4,911 Views)

@Spruce wrote:

@Ravens Fan wrote:

I think that might be an error in the way that part of the help file was written.

 

I know you can wire in a 1-D array of waveforms.  But what is the physical meaning of a 2-D array of waveforms?  A 2-D array of waveforms is not logical.



Well, it does make sense for passing in multiple points that are not sampled at equal time intervals to multiple plots.


That would be an XY graph. A waveform, by definition, has a single sampling rate. All of the points are equally spaced.

 

With respect to what you are seeing in the Help, I'd agree that the Help file is in error. A 2D array of waveforms doesn't make sense to me either.

Message 6 of 9
(4,910 Views)

@smercurio_fc wrote:
...

That would be an XY graph. A waveform, by definition, has a single sampling rate. All of the points are equally spaced.

 

With respect to what you are seeing in the Help, I'd agree that the Help file is in error. A 2D array of waveforms doesn't make sense to me either.


Below is a screen shot that shows me clearing both grpah and chart WF data types.

 

A 2D array of WFs is the history.

 

WF_DataType.PNG

 

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 9
(4,903 Views)

But the Help isn't talking about the history, it's talking about the value. And if you try to use the Value property you'd get the same wiring error. So, either LabVIEW is broken, or the Help needs to be fixed.

0 Kudos
Message 8 of 9
(4,900 Views)

yes!

 

An extra space between paragraphs and sub-section headers would be an improvement.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 9 of 9
(4,898 Views)