Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Serial In Split String by Comma


Terrapin Nov 9, 2018 03:21 PM

I'm having trouble reading a large string obtained via SerialIn into discrete variables.  The raw data string is separated by a comma, but not all variables are numeric.  For example:

2017-10-31T06:55:36,22.3,14.6,1011.2,-0.003,0.039,0.196,-0.001,0.3,0.5,T:H:P:NO2:SO2:CO:O3:PM2.5:PM10,58862

I tried using SplitStr(ResultString(),InString,",",1,5) to split based on the comma, but I think the non-numeric data messes it up and I only NaN. 

I tried using the 10 option of SplitStr to extract only the numbers, but it doesn't seem to be able to capture all the variables, and is really unwieldy since the data string is quite long. 

Thanks in advance,


ariklee Nov 30, 2018 11:50 AM

Hi Terrapin,

How many resulting strings do you expect (how many strings after the split?) Try putting that in place of your "1" in the 4th argument for the SplitStr command.  E.g., instead of:

SplitStr(ResultString(),InString,",",1,5)

Try:

SplitStr(ResultString(),InString,",",12,5)

Log in or register to post/reply in the forum.