LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I use a timestring saved from LV as a csv spreadsheet file as the x axis of a LV chart?

I'm saving the timestring portion of a timestamp as HH:MM:SS  along with each set of data fields to a cvs spreadsheet file, i.e. each row of the file starts with the timestring followed by data in each remaining column. The first row contains data field headings. I can read this file back into LV with no problem and can remove the header row but cannot find a way to use that timestring as the x axis of a chart graph. I have no problem graphing the data in that format within Excel itself. Can anyone help?

Thanks,

DennisR

0 Kudos
Message 1 of 8
(3,198 Views)

Correction, the timestring is saved in "HH:MM:SS" format to a csv file, i.e. 10:29:55

Thanks,

Dennis

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

Do you have more then one day of data recorded as time-stamps so that you need days or are you just looking for the relative time? 

 

Once you can turn the time-string back into a time-stamp it should just be feeding the timestamp array into an X-Y Graph.

0 Kudos
Message 3 of 8
(3,182 Views)

A new file starts each day, so there is only one days worth of data in each file, the date is part of the filename so I don't save the datestring portion as part of the file data, I could if necessary though. I only need to show hours minutes and seconds on the x axis. I can't find any way to convert the timestring as read in from the file to an actual time stamp for use on the axis.

 

Thanks,

DennisR

0 Kudos
Message 4 of 8
(3,176 Views)

This should do the conversion of Time-string to time stamp, I'm not sure if theres a built-in VI and I'm sure I'll find out eventually but for now this works.

 

So just pass your array of time stamps through this into a time-stamp array and write to X-Y graph.Time Extract.png

0 Kudos
Message 5 of 8
(3,174 Views)

This seems to be getting close. There however is a 5 hour difference between the time read in from the file and the timestamp that is produced. I checked the calculations and the number of seconds calculated from the hours, mins and seconds comes out right. The timestamp produced is 5 hours earlier than that in the file. Is it possible that the date string needs to be incorporated into the calculations?

Thanks,

DennisR

0 Kudos
Message 6 of 8
(3,155 Views)

Check the timestamp indicator, it is trying to write your time-stamp to your time-zone, so you will need to change the time-stamp to universal time. For the time-stamp indicator it is easy enough you just need to edit the indicator to display universal time, however for a purely data sense it is a bit odd, I have never found a straight forward way to do it so I use the conversion between Time in Seconds and Date/Time to do it for me.

 

Time Extract.png

0 Kudos
Message 7 of 8
(3,148 Views)

Actually I just had another thought that may be even easier, if you calculate the time as a straight number of seconds and use that at the X array for the X-Y graph then you should simply be able to edit the display of the X scale to come up as a time notation anyways, it involve s a little less work with the number and a little more front panel playing, but both should work.

0 Kudos
Message 8 of 8
(3,147 Views)