How to open series of files in a loop

3 ビュー (過去 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 Center および File ExchangeCharacters and Strings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by