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

2 vues (au cours des 30 derniers jours)
flashpode
flashpode le 14 Sep 2021
Commenté : flashpode le 14 Sep 2021
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

Réponse acceptée

Matt J
Matt J le 14 Sep 2021
Modifié(e) : Matt J le 14 Sep 2021
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 commentaire
flashpode
flashpode le 14 Sep 2021
I guess but then put those numbers as 00 min 02 sec

Connectez-vous pour commenter.

Plus de réponses (1)

Walter Roberson
Walter Roberson le 14 Sep 2021
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"

Catégories

En savoir plus sur Dates and Time dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by