08-09-2011 03:00 AM
Hello all,
Thanks all for serie of suggestions
I went to regexp cause "nn.nn" could be "open" if probe is not connected so it was a manner to
manage this exception. here three possible messages :
\s\s26.41\s\s\s\sopen\00\s\n
\s\sopen\s\s\s\s25.42\00\s\n
\s\sopen\s\s\s\sopen\00\s\n
Regards
Tinnitus
08-09-2011 04:35 AM - edited 08-09-2011 04:38 AM
big erratum right ones are
\s\s26.41\s\s\s\s25.42\s\n
\s\s26.41\s\s\s\sopen\00\s\n
\s\sopen\00\s\s\s\s25.42\s\n
\s\sopen\00\s\s\s\sopen\00\s\n
08-09-2011 08:04 AM - edited 08-09-2011 08:06 AM
That's quite different from the original post 😉
Here's a quick example of code to extract those string values. Since I have no clue what you will be doing next, I placed them into a 2-D array. Depending on what you do next, there may be better ways of implementing the code.
It still uses Scan from String. I'm sure an elegant solution can also be done using regular expressions.
08-09-2011 09:01 AM
I think my head is about to explode.
Of course, this always seems to happen whenever I look at regex.
08-09-2011 09:10 AM
regex are our friends 😉
08-09-2011 10:23 AM
@tinnitus wrote:
big erratum right ones are
\s\s26.41\s\s\s\s25.42\s\n
\s\s26.41\s\s\s\sopen\00\s\n
\s\sopen\00\s\s\s\s25.42\s\n
\s\sopen\00\s\s\s\sopen\00\s\n
After looking at these possible messages I think you should definitely go with the Scan from string function. LabVIEW do not support NULL character \00 in regex matching, you will get error -4702 (so sad, regex are so cool).
Ben64
08-09-2011 10:30 AM
@ben64 wrote:
After looking at these possible messages I think you should definitely go with the Scan from string function. LabVIEW do not support NULL character \00 in regex matching, you will get error -4702 (so sad, regex are so cool).
Ben64
Don't let that stop you.
08-09-2011 10:41 AM
08-11-2011 03:57 AM
yes and no,
i mention "open" but i forgot \00
the buffers given were 4 differents buffers depending if all (2) sensors are presents or not
Thank you for all detailed examples
Regards
Tinnitus