saving files in a loop with different names

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

Geoff Hayes
Geoff Hayes 2021년 6월 15일
hesam - how should each file be named? What is the naming convention that you wish to adopt for your files?
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일

1 개 추천

for k=1:20
...
filename = sprintf('info%d.dat', k);
writematrix(M, filename); % data in M
...
end

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Entering Commands에 대해 자세히 알아보기

질문:

h k
2021년 6월 15일

댓글:

2021년 6월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by