I want to be able to save a .fig to a folder of the users choosing. Right now the user can choose the name of the file, but not which folder it is saved to. Currently it is saved by diffult to curr dir. What can I do?
fignew = figure('Visible','off'); % Invisible figure
newAxes = copyobj(handles.T2img,fignew); % Copy the appropriate axes
set(newAxes,'Position',get(groot,'DefaultAxesPosition')); % The original position is copied too, so adjust it.
set(fignew,'CreateFcn','set(gcbf,''Visible'',''on'')'); % Make it visible upon loading
saveas(fignew, uiputfile());
delete(fignew);

 채택된 답변

Stephen23
Stephen23 2018년 6월 5일
편집: Stephen23 2018년 6월 5일

0 개 추천

You need to get the second (path) output from uiputfile:
[useName,usePath] = uiputfile();
saveas(fignew, fullfile(usePath,useName))

댓글 수: 1

Maria Rasmussen
Maria Rasmussen 2018년 6월 5일
Thank you so much! It works! I had spend so many hours trying to figure it out...

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

질문:

2018년 6월 5일

댓글:

2018년 6월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by