Reputation: 63
for m = 1:length(lst_region)
out=cellfun(@(x) str2double(x(1:strfind(x,'_')-1)),lst_region(m));
str=[num2str(out(1)) '.mat'];
save ( str ,distance);
end
Error using save Argument must contain a string. Line 3
I want to save files like '1.mat' '2.mat' etc.. but i have error can you please help me to fix it
Upvotes: 1
Views: 319
Reputation: 1789
If distance
is a variable in your workspace, you will have to call save(str, 'distance');
. You have to enter the name of the variable, not the variable itself.
Upvotes: 2