フィルターのクリア

Extract number from data file name

2 ビュー (過去 30 日間)
Win co
Win co 2013 年 9 月 26 日
コメント済み: Win co 2013 年 9 月 26 日
Hi, I have a list of data file name below :
Data_T2_31_4c_comb_1_9-10-11-12.mat
Data_T2_31_4c_comb_2_9-10-11-13.mat
...
Data_T2_31_4c_comb_3876_25-26-27-28.mat
I would like to extract the number in the 20th character, so that I will have a list of increasing integers [1 2 .. 3876]. Could you show me how to do that please ! Winn

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 9 月 26 日
編集済み: Azzi Abdelmalek 2013 年 9 月 26 日
s={'Data_T2_31_4c_comb_1_9-10-11-12.mat'
'Data_T2_31_4c_comb_2_9-10-11-13.mat'}
out=regexp(s,'\d+','match')
out=str2double(cat(1,out{:}))
  1 件のコメント
Win co
Win co 2013 年 9 月 26 日
works like charm. Great thank !

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT-Files についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by