LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Extract only number which begins string from txt

Solved!
Go to solution

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

Download All
0 Kudos
Message 1 of 11
(2,955 Views)

Hi,

Here's an example to extract Humidity from file:

Exp.png

Edit: DBL instead of I32

 

Reg
0 Kudos
Message 2 of 11
(2,938 Views)

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

0 Kudos
Message 3 of 11
(2,935 Views)

thanks a lot i wil try it now, can you attach a vi file just you created?

0 Kudos
Message 4 of 11
(2,934 Views)
Solution
Accepted by topic author rav88pl

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 11
(2,912 Views)

The attached image (.png) can be converted to VI, see this.

 

Reg
0 Kudos
Message 6 of 11
(2,908 Views)

shoud work , but its opening like a normal picture not structure strange or link to page

0 Kudos
Message 7 of 11
(2,900 Views)

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?

0 Kudos
Message 8 of 11
(2,892 Views)
Solution
Accepted by topic author rav88pl

Once in the tab delimited format, it becomes really simple...(see attached)


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 9 of 11
(2,859 Views)
Solution
Accepted by topic author rav88pl

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.

 

Extract data.png

 

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

 

Extract humidity data.png

 

Ben64

0 Kudos
Message 10 of 11
(2,839 Views)