필터 지우기
필터 지우기

How to open series of files in a loop

조회 수: 1 (최근 30일)
Vaultec
Vaultec 2014년 6월 26일
댓글: Vaultec 2014년 6월 26일
Hi, new to matlab so not quite sure how to do this.
I have a series of folders labled 50um,100um,150um...to 1000um. In each of them is a .mat file named parameters. I would like open each of them and load the files as a seperate variable from A-T.
Is there a way to create a loop that does that
Thanks in advance

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 6월 26일
for k=50:50:1000
folder=sprintf('%dum',k)
file=fullfile(folder,'parameter.mat')
data{k}=load(file)
end
To acces your data
data{1}
data{2}
It's not recommended to create several variales.
  댓글 수: 1
Vaultec
Vaultec 2014년 6월 26일
Thank you it worked perfectly

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by