Saving problems, desired name
3 views (last 30 days)
Show older comments
I'm trying to save anything under the name I want, for example: savename= input('Save as:','s'); save(savename);
but this doesnt seem to be working. Please help, thank you :)
0 Comments
Accepted Answer
Image Analyst
on 28 Dec 2015
Try this:
% Get the name of the file that the user wants to save.
% Note, if you're saving an image you can use imsave() instead of uiputfile().
startingFolder = userpath % Or "pwd" or wherever you want.
defaultFileName = fullfile(startingFolder, '*.*');
[baseFileName, folder] = uiputfile(defaultFileName, 'Specify a file');
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName = fullfile(folder, baseFileName)
% Now save whatever variables you want into a mat file
save(fullFileName, 'yourVariable1', 'yourVariable2');
More Answers (0)
See Also
Categories
Find more on File Operations 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!