I want to shorten a string.
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
GIORGIO MARTINI
le 25 Juil 2021
Modifié(e) : DGM
le 25 Juil 2021
I have this string that contains information about the date and the hour of the acquistion.
Start=2021-06-11T:12:32:04:122
The result I am looking for is this:
12:32:04:122
0 commentaires
Réponse acceptée
Plus de réponses (1)
DGM
le 25 Juil 2021
Modifié(e) : DGM
le 25 Juil 2021
You can use regexp() on either strings or chars.
timestamp = 'Start=2021-06-11T:12:32:04:122';
out = regexp(timestamp,'(?<=:).*','match')
Given that you probably have more than one timestamp to process, you may have to tweak things depending on whether you're dealing with a string array or a cell array of char vectors. In this case, the input is a char vector and the output is a cell array of char vectors. Consider the case where the input is a cell array of char vectors:
timestamp = 'Start=2021-06-11T:12:32:04:122';
timestamp = {timestamp; timestamp; timestamp};
out = regexp(timestamp,'(?<=:).*','match');
out = vertcat(out{:})
0 commentaires
Voir également
Catégories
En savoir plus sur String Parsing 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!