LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

scan from string

Hi everybody!!

I got this string "6:1:0x0:0x3:0:1:0: 70.90:B:A:" in which all colons are to separate each data value. By using scan from string function I´m trying to separate them, but i doesn´t works fine.
The scan string is the following "%f:%f:%s:%s:%b:%b:%b:%f" but I just can remove the two first values of the string, because I got an error in arg3.
I think the function doesn´t differ the colon and it reads it as a character from data.

How can I do it??

Thanks in advance

Victor
0 Kudos
Message 1 of 6
(3,805 Views)
You have to select "Use fixed field witdh" for Arg3 & Arg4 and set it to 3.

You get this format string "%f:%f:%3s:%3s:%b:%b:%b:%f"

BJK
0 Kudos
Message 2 of 6
(3,796 Views)
Another approach which does not depend on prior knowledge of the field lengths is to put Match Pattern in a loop with colon as the search string. At the output of the loop create an array of strings with the data in them and then convert appropriately to other data types or formats. The Scan for Tokens (unsure of exact name) function might also be useful if there are multiple delimiters.

Lynn
0 Kudos
Message 3 of 6
(3,785 Views)
Hi BJK

I can´t select "Use fixed field witdh" because not always Arg3 & Arg4 will have the same lenght (the same thing happens with all the other data values), sometimes can be 0x03 and another times can be 0x200,so..how can i do it?

Thanks for answering

Victor
0 Kudos
Message 4 of 6
(3,784 Views)
Try with
%d:%d:%[^:]:%[^:]:%b:%b:%b:%f:%[^:]:%[^:]


CC
Chilly Charly    (aka CC)
Message 5 of 6
(3,775 Views)
Thanks a lot chilly charly, with that string it works perfectly!!!

Victor
0 Kudos
Message 6 of 6
(3,770 Views)