import multiple files with for loop

5 ビュー (過去 30 日間)
Thodoris Ptrks
Thodoris Ptrks 2019 年 12 月 18 日
コメント済み: Thodoris Ptrks 2019 年 12 月 18 日
Hello, i need to know how can i do this with a double for loop,
sza10str2 = importdata("10.0_02_streams.out");
sza10str4 = importdata("10.0_04_streams.out");
sza10str8 = importdata("10.0_08_streams.out");
sza10str16 = importdata("10.0_16_streams.out");
sza30str2 = importdata("30.0_02_streams.out");
sza30str4 = importdata("30.0_04_streams.out");
sza30str8 = importdata("30.0_08_streams.out");
sza30str16 = importdata("30.0_16_streams.out");
i tried something like this but it doesn't woks.
Any suggestions?
Thank you..
x = [10.0 30.0];
y = [02 04 08 16];
for i = 1:2
for j=1:4
sza{i}streams{j} = importdata(sprintf('%d_%d_streams.out', x(i),y(j)));
end
end

採用された回答

Walter Roberson
Walter Roberson 2019 年 12 月 18 日
sza{i,j} = importdata(sprintf('%.1f_%02d_streams.out', x(i),y(j)))
  1 件のコメント
Thodoris Ptrks
Thodoris Ptrks 2019 年 12 月 18 日
thank you!!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by