09-17-2008 11:49 AM
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
09-17-2008 12:09 PM - edited 09-17-2008 12:10 PM
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.
09-17-2008 12:48 PM
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)
09-17-2008 01:00 PM
09-17-2008 01:19 PM
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
09-17-2008 01:32 PM
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.
09-17-2008 01:49 PM
09-17-2008 04:15 PM
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?
09-17-2008 07:07 PM
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
09-18-2008 12:35 PM
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