Hello,
I want to run a for loop that has an id=1:100 and at the end of each iteration I want matlab to save the results under a file name "Trace_id". So at the end of the programe I will have files called Trace_1 , Trace_2 ,etc...
Thank you

 채택된 답변

Ameer Hamza
Ameer Hamza 2020년 10월 18일
편집: Ameer Hamza 2020년 10월 18일

0 개 추천

Something liks this
for id=1:100
% do your processing
M; % matrix to write to file
filename = sprintf('Trace_%d', id);
writematrix(M, filename)
end

댓글 수: 3

Vladimir Sovkov
Vladimir Sovkov 2020년 10월 18일
편집: Vladimir Sovkov 2020년 10월 18일
Maybe, either i or id throughout but not both. Another way
filename=strcat('Trace_',num2str(i));
Ameer Hamza
Ameer Hamza 2020년 10월 18일
@Vladimir, thanks for pointing out.
yusra Ch
yusra Ch 2020년 10월 18일
Thank you guys for your help, I really appreciate it

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Fortran with MATLAB에 대해 자세히 알아보기

질문:

2020년 10월 18일

댓글:

2020년 10월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by