How to save a file with name saved in a variable ?
Show older comments
I need to save the output of my script in a .mat file which have as name the name I extract from the cell of an excel file.
The way I get the name is this:
[filename, filepath, ~] = uigetfile('*.xlsx');
[~,nnn] = xlsread([filepath, filename], i, 'A:A'); %import subject name
Name=[nnn(2,:)];
So the name is saved inside variable 'Name', and it changes every time inside the loop ( every time it takes it from a different excel work page).
filename=Name
save (filename , 'variables') doesn't work
and
filename=sprintf('%s',[Name{:}]) gives the error of 'cell' input.
How can I solve this?
Answers (0)
Categories
Find more on MATLAB 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!