LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

split array to make seperate plots on xy graph

Hello,

 

I have a large array which contains gps data of several runs in a helicopter.  Each run is identifed by the last column in the array being the same number eg.

 

lat       long   1

lat       long   1

lat       long   1

lat       long   2

lat       long   2

lat       long   2

lat       long   2     so everything with a 1 at the end is part of the same run, hope that makes sense.  Each run could contain different amount of rows depending how long the run was.

 

What i need to do is programatically strip the array to seperate runs based on the last column and plot them on an xy graph as seperate plots so when you look at the graph you can see all the runs as different colors.

 

Thank in advance I hope someonce can help.  If this doesnt quite make sense please reply and i will try to make it more clear.

 

Cheers

 

Daniel

0 Kudos
Message 1 of 10
(4,144 Views)

You need to iterate through your array looking at the last column.  Depending on what the last number is, you build the value of the row into a particular array.

 

Do you know how many different runs you could possibly have?

0 Kudos
Message 2 of 10
(4,136 Views)

Hi,

 

Yea i guessed that i just look at the last number and make an array until the last number changes to something different, but how do i make the program creata a new array when it changes and not just add the values back on to the bottom of the previous array.

 

Not too sure on the number of runs depends on what the pilot has to do.  What are the limits of plots on a xy graph??

 

Cheers

 

 

 

0 Kudos
Message 3 of 10
(4,123 Views)

The problem with not knowing the number of runs is that you don't know how many arrays to work with.

 

You may need to work with a 3-D array so that you have a 2-D array for each run, and the runs are built up in the 3rd dimension. The problem here is that all 2-D arrays have to be the same size.

 

I don't think there are any real limits on the number of plots in an XY graph.  At least none that can be reached in a practical application.

 

Since you want to go to an XY graph, you may want to build your data into an array of clusters.  Each cluster element represents one run, and inside that cluster is an array of X data and an array of Y data.  Look at the help for XY graphs to see the data structures possible for XY graphs.

Message 4 of 10
(4,112 Views)

Hi,

 

Thats all starting to sound complicated with 3d arrays.

 

The data i put into the array starts off in a text file, would there be an easier way to manipulate the text file before putting it into an array to get the result i require?

 

Thanks

 

 

0 Kudos
Message 5 of 10
(4,089 Views)

Hi theno,

 

what you can do "manually" to the text file can be done faster by LabView Smiley Wink

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 10
(4,085 Views)

Hello,

 

I wasnt saying to do anything manually, i was just saying could i use labview to seperate the text document to make it easier to do what i require than it is to seperate the array to do what i need.

0 Kudos
Message 7 of 10
(4,082 Views)

First you have to figure out what you want the data structure to look like going into the XY graph.  I am guessing an array of clusters where each cluster contains an X array and a Y array is most appropriate.  But that is your decision, you know your application better.

 

Once you figure that out, then you programmatically iterate through your file.  Start with element 0 of the cluster array.  As long as it is graph 1, then you append the X and Y values to the end of the respective arrays in that cluster element.  Once you detect the graph number has changed, then you start working with cluster element #1 and so on.  I think this could all be done with just a single loop.

Message Edited by Ravens Fan on 09-09-2009 11:04 AM
0 Kudos
Message 8 of 10
(4,075 Views)
If you promise that the data is grouped, you can try the code in this example.  I've quickly stripped down a more general purpose VI, hopefully it isn't too buggy.
0 Kudos
Message 9 of 10
(4,059 Views)

Hello Darin,

 

That seems to be doing exactly what i need.  Thank you very much for your help.

0 Kudos
Message 10 of 10
(4,038 Views)