saving with variable name

조회 수: 1 (최근 30일)
Sanjana Sankar
Sanjana Sankar 2019년 7월 30일
댓글: Sanjana Sankar 2019년 7월 30일
I want to call a function twice. And this function has to save a mat file. So each time it is callled, I want to send a variable name that it must use as the name of the .mat file.
For example:
function mat_fil=(filename)
{ C = cells that i want to save;
save(filename.mat, 'C');
}
end
How do I do this?

채택된 답변

Alex Mcaulley
Alex Mcaulley 2019년 7월 30일
function myfun(filename,C)
save([filename '.mat'], 'C');
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by