Extracting numbers from a filename

33 ビュー (過去 30 日間)
Sahil Jain
Sahil Jain 2019 年 1 月 11 日
編集済み: Akira Agata 2019 年 1 月 11 日
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?

回答 (1 件)

Akira Agata
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

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by