Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

parsing string

I'm trying to find the most efficient way to parse a string and format into seperate strings. Example, if I read this string:

>6.097E+02,E03,0.000E+00,0.000E+00,2.184E-02,8.320E-01,E03,2.327E+02,0.000E+00,0.000E+00

I want to omit the ">" and splt the string by "," as read left to right, to format into 10 different strings as in:

6.097E+02
E03
0.000E+00
0.000E+00
2.184E-02
8.320E-01
E03
2.327E+02
0.000E+00
0.000E+00

I figured to use some string array and perform some comparison but it seems to not work for my attempts.
ANy help or examples would be appreciated.
Thanks
0 Kudos
Message 1 of 3
(2,932 Views)
Answered here.
0 Kudos
Message 2 of 3
(2,925 Views)
Hello,

You should be able to use the substring function in the string palette to take all but the first character (the '>') by using an offset of 1, and then use the spreadsheet string to array function on the resulting substring with a comma delimiter to return an array of the strings you'd like. That is, entries in the resulting string array will be the strings you wish; you can futher make use of the array palette to take specific elements (strings) and the string to number conversion functions if you'd like to perform arithmetic operations on those specific values 🙂

That should do the trick with only a couple of functions 🙂

Best Regards,

JLS
Best,
JLS
Sixclear
0 Kudos
Message 3 of 3
(2,906 Views)