09-08-2009 08:48 AM
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
09-08-2009 09:07 AM
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?
09-08-2009 09:27 AM
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
09-08-2009 11:12 AM
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.
09-09-2009 07:33 AM
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
09-09-2009 07:45 AM
09-09-2009 08:22 AM
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.
09-09-2009 10:03 AM - edited 09-09-2009 10:04 AM
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.
09-09-2009 12:31 PM
09-10-2009 03:07 AM
Hello Darin,
That seems to be doing exactly what i need. Thank you very much for your help.