LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XY Graphs with X values from 1d Array, and Y values from 2d Array

Solved!
Go to solution

I have a 1D array of times t, and a 2d array where each column is a function f1(t), f2(t), f3(t), f4(t).

 

How do I generate the cluster needed as an input to the Graph Indicator from these two things to plot f1,f2,f3,f4 on the same graph? or ever have each on their own graph?

0 Kudos
Message 1 of 7
(5,412 Views)

Hi math,

 

use an autoindexing FOR loop to index your Y 1D data from your 2D array. In the loop you build a cluster of X and Y 1D array, after the autoindexing output tunnel you will have an array of plots for your XY graph…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(5,407 Views)
What does yours look like? Each time I try to create it I get an error that my dimensions are wrong
0 Kudos
Message 3 of 7
(5,396 Views)
Solution
Accepted by topic author ijustlovemath

Hi math,

 

as I told you:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 7
(5,390 Views)

I managed to make it work by doing this:

snippet.png

 

That subVI just takes the 2d array and outputs a reshaped 1d array from the column vector given by the other input.

 

Final question, this thing will be part of a VI that runs once every iteration. Is there any way to "concatenate" the graphs of each iteration to show an overall graph?

0 Kudos
Message 5 of 7
(5,347 Views)

Also, the reason for using that subVI instead of just autoindexing is that autoindexing a 2d spits out rows, when I wanted columns. An alternate solution would be to transpose the solutions array and just use autoindexing.

0 Kudos
Message 6 of 7
(5,337 Views)

Hi math,

 

autoindexing a 2d spits out rows

Yes, that's the correct order of things in a 2D array …

When you have measurement data, e.g. from DAQmxRead, you get your data row-wise!

 

An alternate solution would be to transpose the solutions array and just use autoindexing.

Yes, that's the (most probably) more efficient solution…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 7
(5,268 Views)