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.

SplitStr with multi-dimensional array


sinusoid Jun 9, 2015 03:34 PM

I want to cycle through collecting and splitting a string using a multi-dimensional array. I have the following code...
Public EXOIn As String * 200
Public EXOParse(16,30) As String *15, i

SerialOpen(EXOPort,9600,0,0,2000)


Scan (1,Min,0,0)

SerialOut(EXOPort,"run" + CHR(13),0,3,100) 'Starts the EXO sampling at 1Hz

For i = 1 To 30
SerialIn (EXOIn,EXOPort,100,"#",100)
SplitStr (EXOParse(-1,i),EXOIn,CHR(32),16,4)
Next i

NextScan

This should put each new set of records into the next part of EXOParse, correct? It does not split the data at all. SplitStr works fine if I treat EXOParse as a single array of length 16.


Sam Jun 14, 2015 07:02 AM

I like to think of arrays like a spreadsheet. Page, row, column. In this case, 30 rows of measurements. Each row containing 16 columns of values. Increment through the 30 rows. Place the result of the split process into the array starting starting in row "i" and column 1.

http://basiclogging.blogspot.com/2012/10/arrays-in-crbasic.html

Public EXOParse(30,16) As String *15, i

For i = 1 To 30
SerialIn (EXOIn,EXOPort,100,"#",100)
SplitStr (EXOParse(i,1),EXOIn,CHR(32),16,4)
Next i


sinusoid Jul 1, 2015 03:41 AM

Sam, thank you for the response, that works great. How do I go about using SpaAvg on the resulting data? I'd like to take the average of all the (#,1) cells, (#,2) cells, etc. I tried this...

AvgSpa (Temp,30,EXOParse(1,1))

But I can see why that doesn't work.

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