LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Efficient way to parse output of VISA Read into array

Hello everyone.

 

I'm using LabVIEW 2015 and I came across an issue. I have several multi-channel instruments, controlled via VISA, which have the capability to perform measurements on all channels simultaneously.

 

Now, due to the nature of VISA, of course, the output of a query is a string. Suppose for the sake of the argument that it's formatted like

 

Instrument-Dependent String - CH1 -> 11000101, CH2 -> 235234, CH3 -> 484823, CH4 -> 7394231

 

Is there a neat way to collect the four (in this case) measurement values without having to construct a bulky pattern-matching structure (Using for example the Match Regular Expression VI)?

0 Kudos
Message 1 of 4
(3,183 Views)

Hi i.,

 

there is SpreadsheetStringToArray:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(3,171 Views)

There are a lot of different options, depending on the structure of the string.

In this case, I would put up a loop to 'Match Pattern' the > character, take the 'after substring' output and 'Scan from string' it as decimal.

Do the same with 'remaining string' output until the 'Scan from string' fails.

Just an example.

 

Well, GerdW's solution is much quicker to implement!

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 3 of 4
(3,168 Views)

I would just use a loop with a couple of Match Patterns inside.  You can use that to parse out each value separately and autoindex the output value.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 4
(3,160 Views)