필터 지우기
필터 지우기

Put a variable in a file title name

조회 수: 4 (최근 30일)
yusra Ch
yusra Ch 2020년 10월 18일
댓글: yusra Ch 2020년 10월 18일
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일
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
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개)

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by