saving files in a loop with different names

27 ビュー (過去 30 日間)
h k
h k 2021 年 6 月 15 日
コメント済み: Stephen23 2021 年 6 月 15 日
hello
in my code created one file is name (info.dat)
I have save every file has created.
File content attached
for k = 1:20
...
% here created (info.dat)
...
end
  3 件のコメント
h k
h k 2021 年 6 月 15 日
it does not matter
The name of the (info.dat) plus one to 20
example (info1.dat, info2.dat, ...)

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

採用された回答

Scott MacKenzie
Scott MacKenzie 2021 年 6 月 15 日
for k=1:20
...
filename = sprintf('info%d.dat', k);
writematrix(M, filename); % data in M
...
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by