LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

graph unrelated data from file

I have a text file that contains different data messages in time format. I need to read the data one line at a time and graph the correct columns on an XY axis.
If the message is a 2R, then columns 4 and 5 are plotted (X,Y) one graph
If the message is a 13R, then columns 3 and 4 are plotted (X,Y) second graph
Time is in column 2 on all messages
How do I get these two different plots to show up on the same graph and update as the file is read?
I'm reading the file one line at a time due to large file size.
 
here is an example format of the data.
 
2   R   29.55   3.99   39.36    9.45
2   R   29.56   3.99   39.50    10.11
2   R   29.57   3.99   40.55    10.50
13  R  29.58   39.52  9.65     4.66
13 R   29.59   39.75  9.85    4.66
 
I've tried using case structure to pull the right columns from each message but am confused as to how to dump onto the graph as the loop runs.
 
Any suggestions?
 
0 Kudos
Message 1 of 8
(2,689 Views)
jdam,
I'm a little confused. You mention that you want one plot one one graph and then another plot on a second graph. Later on you ask "How do I get these two different plots to show up on the same graph and update as the file is read?" My question is, are you going to have one graph with two plots, two graphs with one plot or three graphs (two with one plot and one with two plots)?
 
In any event a case structure with the xy graphs located in the different cases should get you squared away. You would create a case for the 2r and then another case for the 13 r. In the 2 r case write the appropriate columns to a graph and in the 13 r case write the appropriate columns to a second graph.
 
 
Chris C
0 Kudos
Message 2 of 8
(2,677 Views)

Hi Chris,

Thanks for the reply.

I'm attempting to get two plots onto one graph from different cases. The 2r data is lat and long for a flight path. The 13r is lat and long for a target. As the data is read from file, I want to show the flight path (2r) plot in progress, when a 13r is read, I want the target to show up in the same graph. How do I pass the data out of the case structure such that two plots are created onto the single Graph.

0 Kudos
Message 3 of 8
(2,676 Views)

Here's a very simplified example of how I would start to approach your problem. You build a multi-plot graph as an array of clusters. So, you could have shift register for each cluster and in each of the cases, you would build up the data for one of the plots and just pass the shift register through for the other plot.

Message Edited by Dennis Knutson on 01-18-2007 03:49 PM

0 Kudos
Message 4 of 8
(2,674 Views)

Dennis,

Thanks for the suggestion and example description. I'll let you know how this works out.

0 Kudos
Message 5 of 8
(2,653 Views)
Dennis, A few problems.
First, I don't have arrays in the case structure, I have x and y elements and I'm using a For loop.
Second, I can't get the graph to update during each execution of the loop.
I've attached a picture -
0 Kudos
Message 6 of 8
(2,645 Views)
It looks like you want to build the two different plots point by point. That requires just a little bit different strategy with the shift registers. Try the VI I've attached with your data. With the example you posted, you are creating a new array each time and there would only be a single point in each plot. I think you could also use the express xy and set the reset input to false.
 
The posted example uses the build array and this is not very efficient when you have large data sets. There is a shipping example called XY Chart that I think you should also look at. It makes an XY graph behave like a chart where you can update it a single point at a time.
Message 7 of 8
(2,640 Views)

Dennis,

Thanks to your help I was able to get something that works for large file.

It may not be pretty, but it works and I can adjust the chart history size to control memory.

Attached is a picture of diagram.

Thanks again

0 Kudos
Message 8 of 8
(2,621 Views)