How to save a file with name saved in a variable ?

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?

2 Comments

Doesn't work how? What's the error message?
You must use
filename=Name{1} ;
And also give a proper extension...

Sign in to comment.

Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Tags

Commented:

on 1 Aug 2017

Community Treasure Hunt

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

Start Hunting!