04-03-2016 01:53 PM - edited 04-03-2016 01:57 PM
Hello Everyone,
I have to read data from a Spreadsheet (*.CSV) and then plot it in LabVIEW.
The File contains three values
Time, Date, Temperatre Value
For Example, here are the Logs.
16:46:59,31/01/14,+018.2C
16:47:59,31/01/14,+018.2C
16:48:59,31/01/14,+018.2C
16:49:59,31/01/14,+018.2C
16:50:59,31/01/14,+018.5C
16:51:59,31/01/14,+018.5C
16:52:59,31/01/14,+018.5C
16:53:59,31/01/14,+018.5C
16:54:59,31/01/14,+018.5C
16:56:40,31/01/14,+018.5C
16:57:40,31/01/14,+018.5C
.
.
.
.
.
.
23:51:24,31/01/14,+015.0C
23:52:24,31/01/14,+015.0C
23:53:24,31/01/14,+015.0C
23:54:24,31/01/14,+015.0C
23:55:36,31/01/14,+015.0C
23:56:44,31/01/14,+015.0C
23:57:44,31/01/14,+014.6C
23:58:44,31/01/14,+015.0C
23:59:44,31/01/14,+015.0C
What i have to do is to create a VI in LabVIEW to visualize this data.
I did it like below:
It looks okay, but X-Axis is Time Axis and 16:46:59 it is just showing 16, i know i haven't done anything to handle this.
But i am not able to find what can i do in this case.
Please suggest how to get exact full time values on X-Axis.
Solved! Go to Solution.
04-03-2016 02:05 PM
04-03-2016 02:31 PM
You should use read text file and scan from string.
Maybe your local time and separators settings gives you simpler format string.
04-03-2016 02:50 PM - edited 04-03-2016 02:51 PM
@Artem.SPb wrote:You should use read text file and scan from string.
You are close. But there are some things in there that will mess you up, like the temperature units and the end of line character(s). I would do something like this.
04-03-2016 03:05 PM
crossrulz a écrit :
@Artem.SPb wrote:You should use read text file and scan from string.
You are close. But there are some things in there that will mess you up, like the temperature units and the end of line character(s). I would do something like this.
I came up with the same solution (only slower!). To add to your comments using a for loop also doesn't add an extra zero at the end.
Ben64
04-10-2016 02:04 AM
Thanks for the help it works. (File Path Control is diconnected in Block Diagram in this case, Read from Text block directy ask for file, if i connect the File Path Control i get an error which is described below)
But i got stuck in another problem an it is related to the File Path Control.
If i use the file Path Control i get an error as follow:
04-10-2016 06:53 AM
File path is empty. Of course vi return error.
04-10-2016 08:33 AM
@Artem.SPb wrote:File path is empty. Of course vi return error.
I added the file path to it by clicking on folder icon.
In the path there are two files which contains logs, first is TEMP.txt and another is Temp_AmbientData.txt
The graph plotted initially is of Temp_AmbientData.txt file, now i change the File Path to TEMP.txt, when i run the LabVIEW VI, it asks for the File again, and this is due to the Read Text file block i think, and even if i specify the Temp_AmbientData.txt file now, it will plot TEMP.txt file
So my question is why the dialogue appears if the path is already specified.
Please run the VI attached you will get to know what exactly is happening.
04-10-2016 10:52 AM
Your VI contains an "orphan" bit of Read from Spreadsheet" code that has nothing wired to the File Path. Diagram-disable (or delete) this extraneous code and your VI will run fine with Temp.txt in the File Path control.
Bob Schor
04-10-2016 10:55 AM
Incidentally, why are you plotting Date and Time on the X Axis? Do you really need to know the date that each data point was recorded? Wouldn't "Elapsed time" (in seconds, minutes, or hours, as appropriate for your data rate) be more useful? If so, you can easily convert "Time" to "Elapsed Time" by creating TimeStamps (as you've done) and subtracting the initial TimeStamp (Time-zero) from all of them. The difference of two TimeStamps is a Dbl, and represents the number of seconds between the two TimeStamps.
Bob Schor