以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]通过串口读取到的gps数据,不知道怎么提取了?  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=133867)

--  作者:yjm789000
--  发布时间:2019/4/22 15:28:00
--  [求助]通过串口读取到的gps数据,不知道怎么提取了?
下面时通过串口读取到的gps数据,标红部分是我需要的数据,要将$GNGGA 开头的行里面N前面和E前面的数据提取出来,以最后一个$GNGGA为主要数据,但是需要可以以最后一个$GNGGA为基准,可以往前面任意前一个,或前前一个$GNGGA,也可以提取到数据?   麻烦老师帮忙指导下!

$GNRMC,011207.00,A,2643.48213,N,11315.73565,E,0.120,,220419,,,D*6B
$GNVTG,,T,,M,0.120,N,0.222,K,D*39
$GNGGA,011207.00,2643.48213,N,11315.73565,E,2,09,1.55,126.7,M,-10.0,M,,0000*68
$GNGSA,A,3,16,32,14,41,,,,,,,,,2.38,1.55,1.80*1B
$GNGSA,A,3,69,83,73,82,70,,,,,,,,2.38,1.55,1.80*10
$GPGSV,3,1,12,10,04,169,34,14,68,093,37,16,43,222,34,22,34,274,23*73
$GPGSV,3,2,12,23,01,316,,26,74,250,16,27,04,187,26,32,53,121,41*73
$GPGSV,3,3,12,40,20,254,,41,44,232,37,42,43,126,33,50,43,126,34*79
$GLGSV,3,1,09,69,24,165,46,70,74,231,29,71,37,324,17,73,43,289,25*6E
$GLGSV,3,2,09,74,11,253,25,80,38,016,14,81,03,040,26,82,12,085,34*65
$GLGSV,3,3,09,83,05,132,24*54
$GNGLL,2643.48213,N,11315.73565,E,011207.00,A,D*7D
$GNRMC,011208.00,A,2643.48195,N,11315.73569,E,0.074,,220419,,,D*65
$GNVTG,,T,,M,0.074,N,0.136,K,D*3F
$GNGGA,011208.00,2643.48195,N,11315.73569,E,2,09,1.55,127.2,M,-10.0,M,,0000*62
$GNGSA,A,3,16,32,14,41,,,,,,,,,2.38,1.55,1.80*1B
$GNGSA,A,3,69,83,73,82,70,,,,,,,,2.38,1.55,1.80*10
$GPGSV,3,1,12,10,04,169,35,14,68,093,37,16,43,222,34,22,34,274,23*72
$GPGSV,3,2,12,23,01,316,,26,74,250,16,27,04,187,25,32,53,121,41*70
$GPGSV,3,3,12,40,20,254,,41,44,232,37,42,43,126,34,50,43,126,34*7E
$GLGSV,3,1,09,69,24,165,46,70,74,231,30,71,37,324,18,73,43,289,23*6F
$GLGSV,3,2,09,74,11,253,27,80,38,016,15,81,03,040,25,82,12,085,33*62
$GLGSV,3,3,09,83,05,132,21*51
$GNGLL,2643.48195,N,11315.73569,E,011208.00,A,D*73
$GNRMC,011209.00,A,2643.48184,N,11315.73572,E,0.168,,220419,,,D*62
$GNVTG,,T,,M,0.168,N,0.311,K,D*34
$GNGGA,011209.00,2643.48184,N,11315.73572,E,2,10,1.55,127.6,M,-10.0,M,,0000*65
$GNGSA,A,3,16,32,26,14,41,,,,,,,,2.38,1.55,1.80*1F
$GNGSA,A,3,69,83,73,82,70,,,,,,,,2.38,1.55,1.80*10
$GPGSV,3,1,12,10,04,169,36,14,68,093,37,16,43,222,34,22,34,274,24*76
$GPGSV,3,2,12,23,01,316,,26,74,250,16,27,04,187,24,32,53,121,41*71
$GPGSV,3,3,12,40,20,254,,41,44,232,37,42,43,126,33,50,43,126,34*79
$GLGSV,3,1,09,69,24,165,46,70,74,231,30,71,37,324,17,73,43,289,22*61
$GLGSV,3,2,09,74,11,253,27,80,38,016,15,81,03,040,22,82,12,085,32*64
$GLGSV,3,3,09,83,05,132,17*54
$GNGLL,2643.48184,N,11315.73572,E,011209.00,A,D*78
$GNRMC,011210.00,A,2643.48190,N,11315.73572,E,0.138,,220419,,,D*6A
$GNVTG,,T,,M,0.138,N,0.255,K,D*30
$GNGGA,011210.00,2643.48190,N,11315.73572,E,2,10,1.55,127.5,M,-10.0,M,,0000*6B
$GNGSA,A,3,16,32,26,14,41,,,,,,,,2.38,1.55,1.80*1F
$GNGSA,A,3,69,83,73,82,70,,,,,,,,2.38,1.55,1.80*10
$GPGSV,3,1,12,10,04,169,36,14,68,093,37,16,43,222,34,22,34,274,24*76
$GPGSV,3,2,12,23,01,316,,26,74,250,17,27,04,187,23,32,53,121,41*77
$GPGSV,3,3,12,40,20,254,,41,44,232,37,42,43,126,34,50,43,126,34*7E
$GLGSV,3,1,09,69,24,165,46,70,74,231,30,71,37,324,18,73,43,289,21*6D
$GLGSV,3,2,09,74,11,253,27,80,38,016,15,81,03,040,20,82,12,085,31*65
$GLGSV,3,3,09,83,05,132,20*50
$GNGLL,2643.48190,N,11315.73572,E,011210.00,A,D*75
$GNRMC,011211.00,A,2643.48198,N,11315.73

--  作者:有点甜
--  发布时间:2019/4/22 15:47:00
--  

参考代码

 

Dim strs As String = ClipBoard.GetText \'从剪切板获取模拟数据

Dim mc = System.Text.RegularExpressions.Regex.Matches(strs,"(?is)(?<=\\$GNGGA).*?(?=\\$)")
For i As Integer = 0 To mc.count-1
    msgbox(mc(i).value)
Next


--  作者:yangwenghd
--  发布时间:2019/10/23 21:40:00
--  
老师,你好,你可以分享一下案例带动我们学习一下吗。
--  作者:haotinghua
--  发布时间:2019/10/24 9:42:00
--  
求分享案例