Extracting numbers from a filename
Afficher commentaires plus anciens
I have a filename (data_23.175_75.125) . I want to extract the numbers from this file name and store them in different variable matrices. How can I do it?
Réponses (1)
Akira Agata
le 11 Jan 2019
Modifié(e) : Akira Agata
le 11 Jan 2019
How about using regular expression?
The following is a simple example.
fileName = 'data_23.175_75.125';
num = regexp(fileName,'[\d\.]+','match');
num = str2double(num);
The result is:
>> num
num =
23.1750 75.1250
Catégories
En savoir plus sur Files and Folders dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!