LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiplot XY Graphs & Data Types

Solved!
Go to solution

Currently working on plotting data from four different pressure transducers onto one XY plot, but so far unable. Additionally, I'm not sure if I'm using the correct data type.

 

As you'll see in the image below, my code takes measurements from the DAQ Assistant and proceeds to split the data into four signals before taking their mean. My predecessor thought to build a matrix from these four split signals along with what I assume is the time stamp. The issue is that only one set of data is being plotted at the moment. I've been trying to change the order of things such that I'm using a cluster as my data type, but I always seem to get an error. 

 

Lately I've been consulting this webpage https://decibel.ni.com/content/docs/DOC-5129 for additional help, but mimicking the path they take doesn't seem to work for my code. 

 

Can anyone lend a hand? 

0 Kudos
Message 1 of 4
(3,909 Views)
Solution
Accepted by topic author moynihaf

All I see are 1D arrays. A Matrix in LabVIEW is a special data type used for... you guessed it, matrix calculations. Do not use it interchangeably with array.

 

The main problem is that you are sending a single cluster into the XY graph, which means a single plot. What you want is an array of clusters. The clusters will be a bundle of 1D array of timestamps and 1D array of measurements. But this is the complicated way to do it, and it means you have to hold on to all of your data as the loop runs, with a lot of unbundling, building arrays, and rebundling. Crossrulz wrote an excellent nugget on how to use a chart for sporadic data which makes things a lot easier, because the chart holds the history for you. Take a look at that post, and if you want to have multiple plots, you can just make an array of the waveforms, as I've done below. Where you see the "random number" dice, you will put your single measurement data that you acquire each time the loop iterates. You can test the program by running it and clicking the "Add Point" button.

 

Sporadic Waveform Chart.png

Message 2 of 4
(3,868 Views)

Thanks for the reply Greg! In regards to "a chart for sporadic data," is it possible to export the chart data elsewhere? I inherited this code and am trying to make sense of it, but my main goal is to chart out the data while also having the functionality of exporting it to an excel file in order to analyze it at a later point. That's why I've gone with arrays thus far. My issue has been that I don't know how to build upon the array such that it is no longer a 1D array. And as you suggested, when trying to figure out how to build upon the array, I found that it is EXTREMELY complicated. 

 

Thanks again for the help, it is much appreciated. 

Message 3 of 4
(3,782 Views)

Yes, there are many ways to get the data into an Excel friendly format. The easiest is to just right click on the front panel chart, then Export >> Export Data to Excel. To do it programmatically, you can right click on the block diagram chart, then Create >> Invoke Node >> Export Data to Excel. This will create an invoke node for you to place in your code. If you prefer to use the "Write to Spreadsheet" VI, you can get the data by right clicking on the block diagram chart Create >> Property Node >> History Data. This will get your data out, in a 2D array, with one entry for each point you wrote to chart. It may be a little cumbersome to work with if you are not used to auto indexing for loops.

Message 4 of 4
(3,773 Views)