LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

data/time reading into chart

In the attached file, I am trying to read the first column of data, and the next column is the value on the x-axis I want it plotted at. How do I read two columns of different data? I have looked in the books I have access to and the help within Labview but am still having trouble.

Thank you,
Ellie
0 Kudos
Message 1 of 6
(3,091 Views)
Ellie,

The first thing you need to do is to read your file in as a spreadsheet file. Then, you display it in a chart.

That sounds simple, but looking at your dataset, there's a few things you should know. First, the "read from spreadsheet VI" is looking for data in columns, like your data set, but columns separated by tabs. Therefore, your data must be saved that way; currently, it doesn't seem that it is. Another thing; you must skip the header portion (labels) of your file when reading.

Next, it would be easier if your time was first, and your data was second in your columns, but that can be overcome. In the VI I am including, I have copied your data set into a file called data.txt, and I've removed the header and separated the column
s with a tab. Then, I read in the data, and I break out each column so I can put the time first, and then I combine them again into a cluster so it can be displayed on an XY chart.

Take a look!

Mark
Download All
0 Kudos
Message 2 of 6
(3,091 Views)
Ellie,
Here is one way of doing it. Take a look at this example (compatible with LabVIEW 4.1 and up) and post comments if you need further help. Basically, I read your file as text; split it; and make use of the Spread sheet string to Array function before I plot your data. Hope this helps./ Mikael
0 Kudos
Message 3 of 6
(3,091 Views)
Thank you. I am trying to get the data from the text file into a string and am having some trouble. I am reading the file from a spreadsheet, and sending the output array to "Array to Spreadsheet String", but I'm not sure this is what I want to do. Is there another way to make an array into a string? Do I need to reformat my data?
Can you offer me any advice?
Thank you.
0 Kudos
Message 5 of 6
(3,091 Views)
I noticed that you changed your file format according to what was said here. Yes, this new file of yours is easier to use but your original file does not have to be changed. Take a look at this example. I now added the file-read part. It will give you a dialog to locate your data file (use this VI with your original file with the header since this VI includes a string split function). Hope this helps. /Mikael
0 Kudos
Message 6 of 6
(3,091 Views)
If you read this file with the "read from spreadsheet file.vi" you get you
data in a 2-D-array. Now it is easy with array- and cluster-functions to
handle the data the way you want.

hope that helps, Niko
0 Kudos
Message 4 of 6
(3,091 Views)