Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Read returns string with excess information- need to pull data from middle of string

Solved!
Go to solution

I am reading data from a TSI flow meter using the Basic Serial Write and Read that uses VISA.  The string read begins with "OK" or an error code and then a carriage return, then the data follows in the form of flow rate comma temp comma pressure comma flow rate comma temp...and so on. The string ends with a CR LF.  I need to pull the flow rate, temperature, and pressure data out of the string and write it to a file.  I am having trouble finding a function that will pull the data from the string.  Any suggestions?  Thank you.

0 Kudos
Message 1 of 3
(3,194 Views)
Solution
Accepted by topic author Ventana

try string subset in the string palette.

Or match pattern if you want more direct control.

 

Also a good way is the scan from string but you must be prepared to read oexactly what comes in or in case of error skip the input.

greetings from the Netherlands
0 Kudos
Message 2 of 3
(3,179 Views)

bedankt!

I think my solution is fairly tedious (see attached), but it works. I'm not sure I understand how Match Pattern or Scan From String would be used. But, now I have the string with only the data. From here, I need to get this data to an array and output to file. How do I convert a string of the form F, T, P, F, T, P... into an array with three columns of data?

I also realized now that I don't have any timestamp data, and I believe that will be a bigger issue. I will probably post that as a separate question.

groeten uit arizona!

0 Kudos
Message 3 of 3
(3,154 Views)