LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Extract/Scan for numbers from multiple lines of strings

Solved!
Go to solution

Hi All,

 

I would like to extract numbers (the data) obtained from a serial acquisition which will be shown in multiple line of strings:

 

$#pressure 20

!@temperature 100

#voltage 1.2

 

I want to extract 20,100 and 1.2 so that I can do further data manipulation. Should I use match regular expression ? I could not get a proper regular expression to extract the numbers.

 

Thank you !

0 Kudos
Message 1 of 16
(5,511 Views)

There are several scan/match functions on the Strings palette. Match Pattern would probably fit your purposes best.

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 2 of 16
(5,503 Views)

i used the format, but i am sure you can use regex...

Example_VI.png

0 Kudos
Message 3 of 16
(5,496 Views)

Hi there! Yes your method works, but it would be better if we can keep all the data into an array separated to pressure, temperature and voltage since we are continuously acquiring data. 

 

Can we put it into array ?

 

Pressure   Temperature   Voltage

20                    100          1.2

21                    101           1.2

 

0 Kudos
Message 4 of 16
(5,486 Views)

@pokerprof wrote:

Hi there! Yes your method works, but it would be better if we can keep all the data into an array separated to pressure, temperature and voltage since we are continuously acquiring data. 

 

Can we put it into array ?

 

Pressure   Temperature   Voltage

20                    100          1.2

21                    101           1.2

 



Whose method? You don't say who you are referring to (and if you don't quote at least part of a message, we don't know unless you tell us).

 

This is no time to keep your cards close to your chest, pokerprof Smiley Very Happy .

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 5 of 16
(5,477 Views)

Hi Cameron,

 

Haha I am referring to apok's method. 🙂

 

Attached is a sample VI that I use according to your method but I have yet able to put the data into arrays. Looking forward to your royal flush !

0 Kudos
Message 6 of 16
(5,469 Views)

you can apply this method...btw, you never said anything about an 'array'  Smiley Wink

Example_VI.png

and if i had not read your mind again....you can put header strings and make it a 2d string array

0 Kudos
Message 7 of 16
(5,464 Views)

pokerprof, I'd love to see what you've done, but could you send it up in LV 2012 format (many of us have not upgraded yet to 2013)? Thanks.

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 8 of 16
(5,459 Views)

as camerond said...can you please post the vi in a lower version?

 

  • work computer is v2012
  • home computer is v2013

thanks!

0 Kudos
Message 9 of 16
(5,448 Views)

Hi guys,

 

Attached here is the block diagram. 

I am using regular expression to extract the value at the end of each string.

 

I would like to put the value to their respective parameters (pressure,temperature etc.) under an array so that I can do further manipulation with the values.

 

Note that the values will be acquired continuously from a serial acquisition port.

 

Hope this is clear and thanks for ye helppp !Smiley Wink

0 Kudos
Message 10 of 16
(5,442 Views)