Extract number on variable name.
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
My variable name is Final_50000_run_1
Is there a way to extract the number 50000 and 1 out.
Thanks.
2 commentaires
Réponses (2)
Azzi Abdelmalek
le 19 Juil 2016
Modifié(e) : Azzi Abdelmalek
le 19 Juil 2016
s='Final_50000_run_1'
regexp(s,'\d+','match','once')
If you want to extract all the numbers
regexp(s,'\d+','match')
0 commentaires
Steven Lord
le 19 Juil 2016
Is this a variable name or a file name? If it is a variable name, I recommend you read question 1 in the Programming section of the FAQ for an explanation of why including data in your variable names is discouraged. If it is a file name, see Azzi's answer.
0 commentaires
Voir également
Catégories
En savoir plus sur Fortran with MATLAB 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!