06-13-2016 09:15 AM
Hello,
I am working with LabVIEW 2013. I am receiving a set of raw bytes 10 times a second that contain ASCII characters:
*Time:09:05:01*Position:[-63.71,-73.581,-117.519]*Quaternions:[0.999102,-0.0025507,-0.041212,-0.00952388]*Euler:[-0.247893,-4.726448,-1.082074]
And so on. What I am trying to do is parse these bytes into an array. Essentially I need it to look for a "*" and parse the data in between each asterick. Something like this for the array:
Time: 09:05:01
Position: [-63.71,-73.581,-117.519]
Quaternions: [0.999102,-0.0025507,-0.041212,-0.00952388]
Euler: [-0.247893,-4.726448,-1.082074]
Can anyone point me in the right direction to get this started? I will also eventually need to plot this data, but one step at a time...
Thanks,
SM
06-13-2016 09:20 AM - edited 06-13-2016 09:21 AM
Hi SteMob,
put these bytes into an array of U8, then convert the array to a string.
Then use SpreadsheetStringtoArray with the asterisk as separator to convert the string into an array of strings, separated at the asterisks.
Then use ScanFromString to get your values from each string…
06-13-2016 09:25 AM
Hi Gerd,
So I am fairly new to LabVIEW, and it's been a little while since I have done any of this stuff. Could you maybe show me an example of this? I'm having trouble just going from array to string...
Thanks
SM
06-13-2016 09:26 AM - edited 06-13-2016 09:26 AM
Well it's kind of a "hack" but you could use spreadsheet string to array.
06-13-2016 09:31 AM
RTSLVU,
How did you make the "array type" and the output array to be strings instead of doubles?
Thanks,
SM
06-13-2016 09:33 AM
Oh, I also failed to mention, these incoming bytes are like an infinite loop, so somehow after it receives bytes for a second or so, I need to delete the old data out so my array doesn't just keep filling up with data for all eternity.
Thanks,
SM