LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

scan from string

Solved!
Go to solution

I have a string hkadc_bin2_offset_gain_check_9p6m.csv out of which i want to extract only 9p6m , i have done this using match expression and string to array function but i want to know if we can do the same by using scan from string or with match regular expression with correct format i am not getting how to use the format string. 

 

Below i am attaching the vi in which i have done this using match expression and spreadsheet string to array, i want to know if there is any more better approach to this.

 

Thankyou

0 Kudos
Message 1 of 17
(5,736 Views)

Hi RC,

 

if the item you look for is always the last in the string you can use IndexArray instead:

check.png

And: DO NOT delete labels of controls/indicators! You may hide them (in the context menu)...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 17
(5,696 Views)

Thanks GerdW for the reply,

 

but i just want to know is there any way of doing this using scan from string directly by specifying only the format string means if only we can do with scan from string wothut using all other functions,

 

i just want to know if we can do by this, because i treis with scan from string but since i have never worked nuch with this function so able to use correct format to separate the characters in strings.

 

0 Kudos
Message 3 of 17
(5,686 Views)

Hello RC,

 

this is not possible with the "scan from String" function. Use the "Match Pattern" function instead, with "[0-9].[0-9]." as search pattern. This searches for the following pattern:

[0-9] : a digit

.       : any character

[0-9] : a digit

.       : any character

 

this works for your example. If there are other conditions to refine the search - we are here to guide you.

 

 

Greets, Dave
0 Kudos
Message 4 of 17
(5,672 Views)

Thanks daveTW for the reply,

 

i tried the way you have explained, it's working good but the problem that i am getting is it is dependent on number of characters like if we are having 2p4m it is good but in case if we this number changes to 12p4m i am having problem, how to give regular xpression such that it does not depend on charcters.

0 Kudos
Message 5 of 17
(5,660 Views)
Solution
Accepted by topic author RChoudhary

@RChoudhary wrote:

Thanks daveTW for the reply,

 

i tried the way you have explained, it's working good but the problem that i am getting is it is dependent on number of characters like if we are having 2p4m it is good but in case if we this number changes to 12p4m i am having problem, how to give regular xpression such that it does not depend on charcters.


Will you always be looking for the content between the last underscore and the file extension?  If so, a submatch is a good choice:

 

Example_VI.png

 

What search rule are you trying to satisfy, exactly?

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 6 of 17
(5,654 Views)

Thankyou Jcarmody for the rply,

 

your solution is working good exactly the way we want, i always fail in using correct regular expression, although my problem is solved but just wanted to ask how to recognize which regular expression will work with our search means it's just by practice or you have studied some documentation, i tried to read from LabVIEW help but not able to get much from it.

0 Kudos
Message 7 of 17
(5,647 Views)

Regular Expressions (regex) is an industry standard, so a site like this is a good place to get some information: http://www.regular-expressions.info/. Note that that site also links to some good tools to create and test regex'es.

 

Mind that regex support differs between parsers, so any given regex isn't guaranteed to be supported by LabVIEW. The functions in LabVIEW that support regex will tell you if you use a format string that isn't supported (that's one of the uses of the error output from these functions). Also note that there generally are two levels of regex support between the LabVIEW functions that eat regex'es; a simple format and a more complete one.

 

Regex is hard to master, I have to read up on them and spend a bit of time with trial and error each time I need to make a complicated regex.

 

Cheers,

Steen

CLA, CTA, CLED & LabVIEW Champion
Message 8 of 17
(5,637 Views)

I often go to the Perl site for the documentation. LabVIEW regular expressions are based on the Perl ones. I also use the attached VI when I am working on regular expressions. It is amazing how many times I have recreated that VI before I finally just saved it and pinned it.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 9 of 17
(5,607 Views)

Hello,

I am working with pump 11 elite . I got pop up error after completion set target volume. In scan from string, which i used for display infused volume.

How i remove this error?

 

My programm is running in side while loop.

 

Here i attached a subvi and input value when i got no error, and input when i got error.

 

Attachement :  window of pop error

subvi

probewatch window

 

0 Kudos
Message 10 of 17
(5,151 Views)