필터 지우기
필터 지우기

take one number from a name

조회 수: 2 (최근 30일)
Alexandros
Alexandros 2011년 11월 29일
Hello people
By using the dir command i get all the files i have in a directory
The names of the files are something like Velo2_11022010_002_E5.xls
How it is possible to take the 2 after the two zeros
This means Velo2_11022010_00 (2) _E5.xls the 2 inside the parenthesis.
because i have the date from dir.date but i need this number also. Any idea?
Thank you

채택된 답변

Fangjun Jiang
Fangjun Jiang 2011년 11월 29일
FileName='Velo2_11022010_002_E5.xls';
d=regexp(FileName,'_','split')
d =
'Velo2' '11022010' '002' 'E5.xls'
If your naming convention for the file is consistent, then str2double(d{3}) is what you need.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 String Parsing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by