link multiple data files

조회 수: 4 (최근 30일)
wendy klein
wendy klein 2011년 5월 31일
Obviously new to MATLAB.. I have written a script & would like to run the script on multiple files without inputting a new file name each time. Thanks

답변 (2개)

Laura Proctor
Laura Proctor 2011년 5월 31일
If all of the files live in the same directory, you can use the LS command. See below for a couple examples:
a = ls;
a = ls('C:\class\*.m');
This will return a char array that you can convert into a cell array using CELLSTR:
b = cellstr(a);
Then, run through your script with each file name contained in the cell array.
  댓글 수: 2
wendy klein
wendy klein 2011년 6월 2일
Thanks,
Is 'C:\class\*.m' the current folder?
wendy klein
wendy klein 2011년 6월 2일
Using the above it seems I still have to input each individual file in my script

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


Walter Roberson
Walter Roberson 2011년 5월 31일
Please see this FAQ

카테고리

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

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by