Get the last for digits as the time this message was sent

조회 수: 2 (최근 30일)
flashpode
flashpode 2021년 9월 14일
댓글: flashpode 2021년 9월 14일
Hey, I have to get the time that each message was send. The message is like this:ç
"!AIVDM,1,1,,A,13cut>1001P:3LRGa`P@jip400S<,0*410002"
and the las for numbers are minute and second, that was sent at 00 min 02 sec.
i have many of these messages and I have to know when they were sent.
Thank you

채택된 답변

Matt J
Matt J 2021년 9월 14일
편집: Matt J 2021년 9월 14일
Is this what you want?
str=char( "!AIVDM,1,1,,A,13cut>1001P:3LRGa`P@jip400S<,0*410002" )
str = '!AIVDM,1,1,,A,13cut>1001P:3LRGa`P@jip400S<,0*410002'
str(end-3:end)
ans = '0002'

추가 답변 (1개)

Walter Roberson
Walter Roberson 2021년 9월 14일
S = "!AIVDM,1,1,,A,13cut>1001P:3LRGa`P@jip400S<,0*410002"
S = "!AIVDM,1,1,,A,13cut>1001P:3LRGa`P@jip400S<,0*410002"
regexp(S, '\d{4}$', 'match', 'lineanchors')
ans = "0002"

카테고리

Help CenterFile Exchange에서 String Parsing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by