12-12-2013 09:12 PM
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
Solved! Go to Solution.
12-13-2013 02:28 AM
12-13-2013 02:57 AM
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.
12-13-2013 04:04 AM
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.
12-13-2013 05:02 AM
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.
12-13-2013 05:37 AM
@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:
What search rule are you trying to satisfy, exactly?
12-13-2013 05:54 AM
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.
12-13-2013 07:24 AM
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
12-13-2013 11:31 AM - edited 12-13-2013 11:33 AM
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.
11-04-2015 11:47 AM - edited 11-04-2015 11:51 AM
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