Extracting numbers from a filename
33 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
回答(1 个)
Akira Agata
2019-1-11
编辑:Akira Agata
2019-1-11
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!