how to extract a number from file name in folder

조회 수: 3 (최근 30일)
liran avraham
liran avraham 2019년 1월 15일
댓글: Rik 2019년 1월 15일
hi,
i want to extract a part of a file name in a folder to use for a loop to automate a process,
i have in a folder files in the pattern of
time_vector@field=yy.xxx@date=dd_mm_yy
i want to extract yy.xxx to use for a loop:
for ii = min(yy.xxx):0.1:max(yy.xxx)
i guess that i need to put all the files names to a variable or a table but i dont figured how.
  댓글 수: 1
Rik
Rik 2019년 1월 15일
Did you try the dir function? You can use it to retrieve a list of file and folder names, so that is probably what you need.

댓글을 달려면 로그인하십시오.

답변 (2개)

KSSV
KSSV 2019년 1월 15일
Read about dir . This will give you all the file spresent int he foder. YOu can give extension and extract only those files.

liran avraham
liran avraham 2019년 1월 15일
i know dir , but how is it automating? i want a code that is capable of taking the min and max of yy.xxx and run the for loop by itself.
i dont want to use dir and choose this by myself. i have about 2000 files times 10 folders

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by