saving with variable name

4 views (last 30 days)
Sanjana Sankar
Sanjana Sankar on 30 Jul 2019
Commented: Sanjana Sankar on 30 Jul 2019
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?

Accepted Answer

Alex Mcaulley
Alex Mcaulley on 30 Jul 2019
function myfun(filename,C)
save([filename '.mat'], 'C');
end

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!