07-17-2013 12:22 PM
Hi am new to Labview, and i am measuring temperature and humdity and saving it in a .csv file with the time and date when the where saved. what i want to do is read them both and display them on a wavform graph with the date and time on the x axis.
i am attaching the vi and the data file so you can see what i have already done.
Solved! Go to Solution.
07-17-2013 12:34 PM
Don't read the same file twice, once as a string, once as a double.
Just read it as a string. Then convert the numeric columns to arrays using the string to number functions. Convert the date and time columns to a timestamp using a Scan from String function.
07-17-2013 01:53 PM
@RavensFan wrote:
Convert the date and time columns to a timestamp using a Scan from String function.
Won't work Thats an excel time and date
Add the time to the date and try XL to Time At least it works if you set the BD Constant to midnight Local time. It was written in Central Standard time and will display in local time. That's ok Excel's Epoch (Time 0) is in Local time so that constant should need to change. (I'll have to find some brilliant workaround some day)
07-17-2013 02:05 PM
The CSV files are text strings.
If he reads them in as strings, then he can combine the date and time using string functions and feed it into a Scan from String function.
07-17-2013 02:44 PM
The csv file I opened had date and time formatted as date and time I.E. the value of time was 0.72 formatted as 17:45:53 (approx)
07-17-2013 02:59 PM
@JÞB wrote:
The csv file I opened had date and time formatted as date and time I.E. the value of time was 0.72 formatted as 17:45:53 (approx)
That's true for the times, but not for the date column. Those are just "General" format.
07-17-2013 03:21 PM
@JÞB wrote:
The csv file I opened had date and time formatted as date and time I.E. the value of time was 0.72 formatted as 17:45:53 (approx)
That's because Excel did an automatic conversion of those data points to a time stamp when it imported the .csv file.
The file itself is not an Excel file but pure text. And Read from Spreadsheet File VI is going to open it up and treat it like pure text.
07-17-2013 03:52 PM - edited 07-17-2013 04:11 PM
Changing as little as I could, I was able to get what you wanted. (I believe this whole program could use a bit of clean up once you get more familiar with LabVIEW - like the fact that you have a while loop that will, by definition, always only run once.)
Basically, the x axes are just numbers of seconds formatted to look like date & time. I changed it so that the time stamp gets set to be the Raw Data's XScale.Offset. Then, the cursor needed to have that offset subtracted to be the index of the 2D array of Raw Data.
Also, you were graphing the "time" as a bright green line (which I removed), and I'm guessing you didn't want that.
EDIT: There's an error with the scan string that I got once I uploaded it and then downloaded a copy. Working on fixing that.
EDIT: When you run it a second time, it works?
07-17-2013 04:19 PM
I give up with fixing the scan string issue. I think you should fix that whole thing because it gets today's date, which might not always be the data at which you're looking. Why doesn't it look at the date provided in the .csv file? I feel a lot of that part is unneccessary…
07-18-2013 08:18 AM
Thanks to everybody for replying.
Quevvy thank you very much mate that is what i needed just wanted to display the time on the x axis of the raw data but i was trying to connect a property node to the raw data graph which was causing the data section graph to stop working. I will try and fix the error with the date aswell because i am getting the date as 12/07/13, when actually the data was saved on 17/0713.