LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

search string about occurrence of more than once

Currently, I have developed a program using while loop and shift register to concaternate continuous input into a long string. I want to detect specific pattern from the long string. Previously, I used the "Match Pattern" to detect the code "$GPGGA", which appear continuously every second. However, the Match Pattern only search the first appeared "$GPGGA" along a string, but not the following ones, are there any ways to do that?

 

A sample is shown below:

 

$GPGGA,153651.228,0000.0000,N,00000.0000,E,0,00,,0.0,M,0.0,M,,0000*4E <= This $GPGGA is detected
$GPRMC,153651.228,V,0000.0000,N,00000.0000,E,,,170310,,,N*7F
$GPVTG,,T,,M,,N,,K,N*2C
$GPGGA,153652.228,0000.0000,N,00000.0000,E,0,00,,0.0,M,0.0,M,,0000*4D <= This $GPGGA is not detected

 

Can anyone help me? Thank you.

 

yukfai88

0 Kudos
Message 1 of 7
(3,275 Views)

1) Mathc pattern accepts an offset where to start the search. If you put it in a loop and use a shift register you can search again past where you last matched.

 

2) Faster searching of large string can be accomplished by first seraching for the first character and then checking what follows. See this Nugget for more on fast searching.

 

Ben

Message Edited by Ben on 03-17-2010 10:48 AM
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 7
(3,272 Views)

Hi, Ben.

 

I have tried already connecting the offset and offset past match to shift register (numeric), but the offset makes the displayed GPS time (generated by program) run at a fraction of time, i.e. the displayed time, takes ahead of the GPS data (generated by my GPS receiver) quickly and the displayed time is initialized again and again. Although I have placed a "wait until next ms multiple", but both data input and data displayed are delayed at the same rate, so the situation doesn't improve. Are there any ways to adjust only the displayed time to update only once a second, rather a fraction of a second, so that the displayed time updates as fast as data from receiver?

 

On the other hand, I think the way of cutting the string starting with "$GPGGA" after every read action is okay for my objective, can you show me the way?

 

Thank you very much for your help.

0 Kudos
Message 3 of 7
(3,256 Views)
You could also consider using the string token VIs. It is designed to look through strings for specific tokens. You will need to use a shift register to keep track of where you are in the string but working with string tokens is fairly easy.


Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 4 of 7
(3,251 Views)

Hi yukfai88,

why did you start another thread?

You can handle your problem if you don't add all the strings to your shiftregister buffer. If your process which searches the string for your substring is not fast enough, then you can use a prallel process which works on it. You can use a queue to send the data between the different loops.

 

Mike

 

link to the other thread

Message Edited by MikeS81 on 03-17-2010 09:58 PM
Message 5 of 7
(3,232 Views)

Drop the $ sign from the search syntax as Lavbiew treats it as a wild card - this very same problem had me scratching my head for many an hour, with the $ symbol I couldn't get it to work, without it was fine!

Have a look at http://forums.ni.com/ni/board/message?board.id=170&thread.id=226877 one of my posts contains a word document detailing the vi I created for extracting NMEA data - Mike

0 Kudos
Message 6 of 7
(3,192 Views)

See attached picture for some ideas, this is using a BT GPS receiver but all you need to do is strip out the Bluetooth front end and replace it with the Visa vi's for it to work - Mike

0 Kudos
Message 7 of 7
(3,177 Views)