01-06-2015 09:49 AM
Hello LabVIEW community. Im beginner of programing in LabVIEW and i stuck with one problem.
Im creating weather station which send measurments to txt file.
I just want to open created by terminal .txt or .log file, plot seperate graphs from txt.
log file and vi in attachment.
I can change display mesurments in log file(change separator), but it will be still mixed in one file.
Can somebody know how to extract from file only eg. all humidity mesurments?
I created vi which open and plot but still have problem of select mesurment which i want.
Sorry for my bad English
Solved! Go to Solution.
01-06-2015 10:19 AM - edited 01-06-2015 10:29 AM
Hi,
Here's an example to extract Humidity from file:
Edit: DBL instead of I32
01-06-2015 10:20 AM
or read 1st, 7th, 13th ROW (its humidity)
humidity:38
direction:106
pressure:998.34
temp:17.8
tempp:18.6
speed:2
humidity:38
direction:106
pressure:998.34
temp:17.8
tempp:18.6
speed:2
humidity:38
direction:106
pressure:998.34
temp:17.8
tempp:18.6
speed:2
humidity:38
direction:106
pressure:998.34
temp:17.8
tempp:18.6
speed:2
01-06-2015 10:20 AM - edited 01-06-2015 10:22 AM
thanks a lot i wil try it now, can you attach a vi file just you created?
01-06-2015 10:33 AM
If you want to use the Read From Spreadsheet File, you need to write the data in a format it can understand. That typically means tab delimited text files.
I recommend you show us your code for where you are writing the file. We can make life a lot easier on you by fixing that.
Typically what you want here is a line with headers (to state what the channel names are) and then data. Each column of data belongs to a specific channel. Each column is seperated by a TAB. A new line in the file for each new data point for all of the channels. So your log should really look something like the attached.
So now you just have to remove the header information and then use Spreadsheet String To Array to turn all of the data into a 2D array of doubles. You can then just use Index Array to get the data of the channel you care about.
01-06-2015 10:35 AM
01-06-2015 10:43 AM - edited 01-06-2015 10:44 AM
shoud work , but its opening like a normal picture not structure strange or link to page
01-06-2015 10:50 AM - edited 01-06-2015 11:17 AM
My wather station is on ATmega and C# code. And it sends to PC UART informations about mesurments (but doesnt matter). I can do log file like you said. its no problem, to seperate TAB. but still i dont know how to extract it from txt.
How to change orientation of colum. ?
take arguments to graph upright not horizontally?
01-06-2015 11:39 AM
Once in the tab delimited format, it becomes really simple...(see attached)
01-06-2015 12:03 PM
You can also use the Read From Spreadsheet File.vi if you log is Tab delimited as in the following snippet. You can then use Crossrulz method to extract a single channel.
To extract a single sensor data with the actual log file format you can do something like this which is a simplified version of R3g code
Ben64