LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Search for alphabets A - Z

I have a long columnar string with both numbers and alphabetical names in them.  The alphabets mark the begining of a new dataset.

I want to be able to search for these names, without knowing what these names are, and where they are.


Is there any generic "Alphabet" search in Labview?


I'm using Labview 8.0.1


Thanks!

Janak
0 Kudos
Message 1 of 26
(9,555 Views)
I think ypu should use "math pattern", see the attached picture for an example.
 
BR
Sture
Message 2 of 26
(9,540 Views)
Strings are always linear. By "columnar string" you probably mean that fields are separated by linefeed characters. 🙂
 
Do you have an example for your string?
 
"Match pattern" mentioned above is certainly an option. You can also use "search and replace string" and right-click, select "regular expression" to search for patterns. There is also "match regular expression". Check the online help.
 
How are you parsing the numbers in the string. For example if you scan each line with format %f (using "scan from string"), you could just monitor the error output to decide when a dataset is terminated.
 
There are many possibilities, the choice depends on the situation. 🙂
 
0 Kudos
Message 3 of 26
(9,523 Views)
Hello Sture,

Am I correct in saying that  [A-Z] in box brackets represents the entire alphabet  in any order and [0-9] means any number between 0-9 in any order?

If thats so, then it will help me a lot!!

Your jpg of the VI explaines how it works, so thats great! Appreciate it.

Hello Altonbach,

Appreciate your reply. Yes, the fields in my string are delimited using linefeed, so its one long string many hundreds of thousands of lines long (typically).

I've attached an example if you're interested in viewing it.  I"m trying to post process theses files using Labview and extract some statistics from them, so need to first seperate them by field.

Cheers,

Janak



0 Kudos
Message 4 of 26
(9,503 Views)

Yes, [A-Z] finds any "big" alphabetic character, one can use [A-Z,a-z] for any alphabetic char. I have made another piece of code which I have tested on the file you sent. Here I use "[A-Z,a-z]newline" to find all "places" in file where an alphabetic char is followed by a newline. Starting from these "places" scan from string is used to format  each line in string to double. Scan from string is inside a while loop which stops when errror occurs, which (I think) should be end of the recordset.

Have a look !

Sture

 

0 Kudos
Message 5 of 26
(9,479 Views)
Yes, this does seem to work great.

Appreciate your help Sture.


~Janak
0 Kudos
Message 6 of 26
(9,465 Views)

Ooops suddenly realized....If all recordsets not have the same length, there will be zero-padding on the shorter ones. If one instead use an array of clusters each recordset can have different length. See code below.

/Sture

0 Kudos
Message 7 of 26
(9,446 Views)
Actually, all the data sets are the same lenght, so I shouldn't run into the zero-padding issue.

Thanks for your concern though, because I didn't know it could be circumvented using array of clusters!!

Cheers,
Janak
0 Kudos
Message 8 of 26
(9,433 Views)
Hello Sture,

Your code worked out great and have been able to get quite a bit ahead with the data manipulation.

I'm applying final touches to my program,and one of the end users suggested I have headers for the variables in the columns.

I am guessing that I would need to do some kind of string search. Maybe search for the position of ([A-Z, a-z] and then use the difference between this and the offset of point for the search result [A-Z, a-z]\r .

Then, will need to go in and get each character.  Would this be the best way to do it?

For your reference, I'm attaching my old text file again.

Any help  would be greatly appreciated.

Cheers,

Janak
0 Kudos
Message 9 of 26
(9,356 Views)
Hi mechanica....,
I just couldn't resist this challenge.....
I have made some changes to the code, with this version one get the recordsets like before and also the characters between the recordesets  "starting with first alphabetic char and ending with last char before newline followed by a number or "-""  . First loop looks i bit messy though....
 
BR
/Sture 
 

Message Edited by sture on 09-18-2007 03:47 PM

0 Kudos
Message 10 of 26
(9,324 Views)