How to request user input to save figure? uiputfile command does not create the file after clicking 'Save'

12 views (last 30 days)
I would like to request user input and modal dialog box to save figure after plotting from the .mat file. But the uiputfile command does not create any file after clicking on 'Save'. The same happened when I tried to save .mat files but I switched to 'uisave' command and the issue was sorted. But the issue remains with saving the figure. Any help would be appreciated.

Accepted Answer

OCDER
OCDER on 19 Jul 2018
The uiputfile only creates the filename and filepath based on where the user wants to save the file. You need to actually write the save command AFTER uiputfile.
[filename, pathname] = uiputfile('*.mat', 'Save the file as');
if isnumeric(filename)
disp('User pushed cancel. Not saving anything')
else
save(fullfile(pathname, filename), 'Var')
end

More Answers (0)

Categories

Find more on Maintain or Transition figure-Based 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!