LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read from file and plot data against timestamp

Hello,
 
I know that there are already many posts regarding the question I m about to ask. But, I somehow dont seem to achieve what I want using the suggestions given in the other posts.
My problem is that, I have a file with the first column as a time stamp containing hour, minute, second and millisecond. The second column in a set of pressure values. I want to plot a graph of these pressure values against the timestamp recorded in this .txt file. Whatever I do, the timestamp values seem to skip by a couple of seconds.
How do i do this correctly?
Also, Is it advisable to use the read from file or the read from spreadsheet file vi? Kindly help me out.
 
Thanks and regards.
0 Kudos
Message 1 of 6
(3,313 Views)
I think it's simpler to use the Read From Spreadsheet File. You should be reading the file as strings and converting the time and pressure values to dbls. If the data is regulary sampled, you can use a waveform graph and set the graph multiplier equal to the difference between the first and second time stamp. Otherwise, use an XY Graph. With 8.2, the Read From Spreadsheet is polymorphic and you can specify strings. In older versions, modify the Read From Spreadsheet per the instructions on the block diagram. You should post an image of your block diagram or the actual VI along with a sample text file.
0 Kudos
Message 2 of 6
(3,303 Views)
Hey, I was having a similar issue the other day.  The first problem I had was how to open the file and actually get the timestamp information.  Since I'm using LabView 8.0, I had to go into Read Spreadsheet File and create a new vi to open strings (in an array form).  That's the Read Spreadsheet File (string) vi below.  Then, I had to figure out how to convert the string of a timestamp to something meaningful to me.  The Timestamp2.vi is how I did that below.  I'm also including a little test file.  So, to run Timestamp2.vi, you will have to input the right base path, and have the Read Spreadsheet File (string).vi in the same place as Timestamp2.  Hope that helps.  I think I'm finally getting this stuff, so let me know if it doesn't work.
0 Kudos
Message 3 of 6
(3,292 Views)
Thank you for your input l1k. Was really helpful. Made a lot of sense. But, I have a little problem. I want to use a while loop for the data plotting, because after I plot the data I have to analyse it to remove peaks and replot on another graph. Do you have any suggestions for that?
Your VI works beautifully, thanks again.
 
Regards.
0 Kudos
Message 4 of 6
(3,267 Views)
Thank you for your help Dennis. Will post again with the details you asked for:)
 
Thanks and regards.
0 Kudos
Message 5 of 6
(3,265 Views)
I'm not sure if I'm answering your question exacly, but here's what I think you want to do.  Wire the time and pressure arrays (double array,not timestamp - I don't really understand how to use that) into a shift register on a while loop.  In the while loop, have a case structure for updating.  If the True/False control of  the case structure is False, just pass the array through.  If it is true, have it delete the point you are looking at.  I made picking that point a control based on the index number of the array.  I just updated to 8.2, so if you have something earlier, let me know.  Also, I'm not an official programmer, so this is very likely not the most efficient way to do it...
0 Kudos
Message 6 of 6
(3,254 Views)