LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Plotting data from a text file in LabView 7.1

This my be a stupid question, but here is goes.  Working with another person, far more LabView experience than I, a VI was created to take data and output it on the screen, real time, as an x-y plot.  Once the test was completed the data was stored in an .txt file which could be read into Excel.  Now the end user wishes to read the old data back into Labview with an x-y plot of the data, the same way it was displayed during the test.  Before I started to pound my head against the wall, thought I would ask this to the group.  Everyone has been very helpful in the pass, so hopefully this will be an easy question for the group.

 

The question is how do I import a text file into Labview and plot it on an x-y screen?

 

Thanks,

 

Scamper

0 Kudos
Message 1 of 15
(14,429 Views)

It really depends on how you've saved the data. If you have a simple text file with x data in one column and y data in another, then you can use the code below. It's just a Read From Spreadsheet File, and Index Array, and Bundle function. Modify as needed for your actual data. If you get stuck, post a small example of your data file.

 

Message Edited by Dennis Knutson on 09-17-2008 11:10 AM
Message 2 of 15
(14,427 Views)

Dennis,

 

Thanks for the quick response.  As for the data we have 8 columns of data with about 40,000 lines.  A rather large data file, data was collected over a long period of time as you can tell.  Hope that explains the problem a little better.

 

Bill (aka Scamper)

0 Kudos
Message 3 of 15
(14,413 Views)
Well, you'll have to modify the VI I posted to match your data. You have not explained which column is which or tried to post a small data file example. The basics of the VI are to extract individual columns and use the Bundle function for a single plot. If you have multiple plots, expand the Index Array function to get all of the columns and after creating each individual plot, you create a multi-plot XY graph with the Build Array function. Just place an XY Graph on a front panel. Turn on context help and on the block diagram, move your mouse over the XY Graph terminal. The help window shows you how to create a single and multi-plot XY Graph. The shipping examples also show you.
Message 4 of 15
(14,408 Views)

Dennis,

 

You have provided me a place to startl, which I am currently trying to do.  But to answer your question I have attached of one of my data files.  Basically we have about 12 plots going on at one time.  The first column is time, then the rest are informational data that is plotted against time. The one question that I have is concerning the number of rows.  Do I have to provide the number or can I just place an EOF at the end of the data file?

 

Bill

0 Kudos
Message 5 of 15
(14,404 Views)

You do not need to specify the number of rows. The Read From Spreadsheet function will default to reading the entire file.

 

Since column 0 is time, you use this for the x array for all plots. Before you get the column data, you'll have to first remove the header information. The Delete From Array will work.

Message 6 of 15
(14,399 Views)
Thank you Dennis, I am working on it now.  Best way for me to learn is by trying.  Thanks again!!
0 Kudos
Message 7 of 15
(14,394 Views)

Out of curiosity, are you trying to display the data:

- in the same time frame as it was collected? (ie, simulating real-time)

- or all at once?

 

 

Cory K
0 Kudos
Message 8 of 15
(14,374 Views)

Cory,

 

I am trying to display it all at once.  The end user wishes to reveiw old data the way it was displayed at the end of the test.  Meaning that the elapsed time would be on the x-axis and the data taken would appear on the y-axis.  With the help of Dennis I have eliminated the header, now I am trying to figure out how to get all the data displayed on a graph.

 

Bill

0 Kudos
Message 9 of 15
(14,360 Views)

Dennis,

 

Well I am getting closer than yesterday thanks to you.  But as you can see I am still having a problems.  If I take the Output from the Second Delete from Array and input that to my X-Y Graph I get far to many graphs.  So this was my solution, but as you see when it is run I only get one graph.  So I am still working at it, any suggestions would be helpful.

 

Thanks,

 

Bill

0 Kudos
Message 10 of 15
(14,340 Views)