LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2 arrays to 1-D array of 2 elements

I have derived an X-plot (frequencies) for each point off my spectrum analyzer, and am reading the Y-trace (amplitude) ... both are an array of data.  I'm trying to get them to cooperate into a XY Plot.  When I try to bundle them then connect it to the XY Plot, it tells me that I'm trying to connect 2 arrays where its expecting 1-D array of 2 elements.  


How can I take my 2 arrays and transform them into 1-D array of 2 elements?

0 Kudos
Message 1 of 7
(2,789 Views)

An XY Graph takes a cluster of two arrays.  So what you described should work. Did you use a Build Array primitive rather than Bundle.  Please post a simple example of what you have tried (using array constants or controls for the data, not your spectrum analyzer).

 

Lynn

0 Kudos
Message 2 of 7
(2,788 Views)

You have saveral choices to create valid data for an xy graph:

 

  • A cluster of an x-array and a y-array (A plain bundle operation)
  • An array of points (what you would get by placing the above bundle operation inside an autoindexing FOR loop)
  • A complex array. (Simply wire the x array to RE and the x-array to IM of RE/IM to Complex and wire to the graph)

I would go with the last option 🙂

 

(To create multiple plots on an xy graph built a cluster array of complex arrays)

 

 

0 Kudos
Message 3 of 7
(2,784 Views)

Seems to me the simplest option here is to use Index & Bundle Cluster Array.  Feed in your X and Y arrays and the output will be an array of clusters of 2 elements.

0 Kudos
Message 4 of 7
(2,780 Views)

Just so happened, I have a for loop in which I am using to derive all the X points.  So if I take the output of the frequency calculation, and bundle it with the Y-trace inside the for loop, then the result should be an indexed 1-D array of 2 elements?  The lines connect now with no complaints. Still isn't drawing anything on the X-Y Plot.   But I think a definite step in the right direction - thanks. 

0 Kudos
Message 5 of 7
(2,773 Views)

can you post your code and the output that you expect.

Tim
GHSP
0 Kudos
Message 6 of 7
(2,770 Views)

The problem I'm having right now is due to instrument drivers - or rather, my not selecting the right one to give me the number of points along the entire span of Y trace apparently.  So I'm waiting assistance from the vendors on this.  If I am still having problems after I get that straightened out, I will post an example of code to help give you an idea of what I'm attempting.

0 Kudos
Message 7 of 7
(2,768 Views)