08-06-2009 05:53 PM
Hi All,
I am trying to parse a string message into an array of numbers so I can check if my event was successful.
\FF\FE\01\FD\02\00\00\00
I know I just need to read through and discard the \, but I don't know how to do that in Labview. I just need to check if the 6th byte = 00 or not.
Thanks! I mostly need help with parsing in labview.
08-06-2009 06:17 PM
08-06-2009 06:23 PM
08-06-2009 06:28 PM - edited 08-06-2009 06:30 PM
Assuming this is a plain ASCII string containing the letters 0..F and "\" as delimiter, you can simply used "Spreadsheet string to array" with the following settings:
Type= 1D U8 array
format= %x
delimiter= "\"
One problem is the extra delimiter at the beginning, so use array subset to skip the first element.
(EDIT: Ahh, Darin beat me with a similar solution. Mine's a little easier ;)).
08-06-2009 07:40 PM - edited 08-06-2009 07:40 PM
altenbach wrote:(EDIT: Ahh, Darin beat me with a similar solution. Mine's a little easier).
I was expecting you to have some byte-swapping, type-casting, hex-code-displaying, quick-dropping action that would somehow manage to do it in a single step.
08-07-2009 10:10 AM - edited 08-07-2009 10:11 AM
amita wrote: I just need to check if the 6th byte = 00 or not.
Thus, you could simply just do this:
08-07-2009 10:24 AM
08-07-2009 06:58 PM - edited 08-07-2009 06:59 PM
amita wrote: I just need to check if the 6th byte = 00 or not.
Here's yet another variation... 😉

08-07-2009 07:46 PM
amita wrote:Thanks! I mostly need help with parsing in labview.
Parsing the question is almost as much fun as answering it.I originally considered this solution as a more general demonstration of parsing strings in LV. When I have a (complex) string to parse I often use 'Scan String for Tokens' as shown in this example. Not much harder than the other solutions and no need to deal with the issue of the leading '\'. I think we still need a Rube Golderg solution as well as an obfuscated version.