I am coding an application that captures an input string from a GPS
device via the serial port. I'm able to get the string just fine
using VISA, my problem is with parsing through the string once I get it
in memory. Looking through the string pallet, I didn't see any
functions available to split the string into each of it's
components. As an example, this is a NMEA sentence I pulled from
the GPS device:
$GPVTG,0.0,T,0.2,M,17.4,N,32.2,K*4D
where:
$GPVTG, The message for Track Made Good and Ground Speed
0.0, Course (in degrees)
T, Indicates True course
0.2, Magnetic course (in degrees)
M, Indicates Magnetic course
17.4, Ground Speed
N, N = Knots
32.2, Ground Speed
K K = Kilometers Per Hour
* checksum tag
4D sentence checksum
Currently, I can pull this string by using the "Match Pattern" string
function - when I get the $GPVTG message, I get the remainder of the
string. After that, I pass the remainder of the string to the
"Scan String For Tokens" function. The problem here is that I
have to index through the string based on where the comma's are located
- and they are not always in the same spot. For example, if I
wanted to get "Ground Speed" in Knots, based on the string above I
would begin indexing at location 12 (assuming that index 0 begins at
the very first comma). This would work - however Course will not
always be 0.0 - it could be 256.0 which then changes the index location
of what I think is the beginning of Speed in Knots.
Here's my question - is there a function in LabVIEW that splits a
string into an array of strings based on delimiters (such as a
comma)? I've used such a function in C# .NET - and it works great
for what I want to do, but the string functions pallet doesn't have
anything like this. If there is no such thing as a split string
into an array of strings - how could I go about making one?
I'm using LabVIEW 7.1 Developer Suite on a Windows XP box.
Thanks in advance for any help!