LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Combining 1D Arrays from two sensors into a 2D array for XY graphing purposes

Solved!
Go to solution

I am currently collecting data from two different sensors, an absolute encoder for angle measurements and a load cell for force measurements, off an Arduino Uno. I have both sensors printing the data into a 1D array and would like to plot an angle v. force graph. I have done some research and found that creating a 2D array is the simplest way to plot both sets of data in an (x,y) form in LabVIEW. However, I do not know how to approach this. I have been reading the forums and watching youtube videos and I continuously see 2D arrays.

 

My main question is how do I combine my two 1D arrays into a 2D array as part of my block diagram and how do I apply the 2D array into (x,y) for my XY graph? Thank you for the help.

0 Kudos
Message 1 of 5
(340 Views)

I'm not sure if this is assumed, but I am collecting the data from a serial port with two analog channels (one for the absolute encoder and the other for the load cell).

0 Kudos
Message 2 of 5
(336 Views)

Hi Sean,

 


@SeanRobert wrote:

I have been reading the forums and watching youtube videos and I continuously see 2D arrays.


Why don't you open the context help window, move the mouse pointer on a XYgraph and just read how to create a XY plot?

The simplest is to use a Bundle function. (Christian might say you should use the "Re/Im to complex" function… :D)

Best regards,
GerdW


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

Hi Sean

 

To plot a XY data, you need to combine the two 1D array using a function called bundle , then you will be able to plot the XY.

In your case, each channel is coming from Serial through Arduino. Convert each channel into 1D array then use Bundle into XY. 

 

LVNinja_0-1707779129045.png

 

0 Kudos
Message 4 of 5
(289 Views)
Solution
Accepted by topic author SeanRobert

@LVNinja wrote:

To plot a XY data, you need to combine the two 1D array using a function called bundle , then you will be able to plot the XY.

 

 


XY graphs accept a variety of datatypes. I actually prefer to create a 1D complex array. LabVIEW knows how to graph IM vs RE. (See here) "Complex" if often the least complex. 😄

 

 

altenbach_0-1662562698048.png

 

Message 5 of 5
(279 Views)