フィルターのクリア

export_fig generates figure even after pressing cancel

1 回表示 (過去 30 日間)
Ghenji
Ghenji 2018 年 5 月 2 日
回答済み: Walter Roberson 2018 年 5 月 2 日
following is the code i use to save the figure in required format, but it produces figure even after pressing cancel button. How do i suppress this execution?
function pushbuttonsaveplot_Callback(hObject, eventdata, handles)
% hObject handle to pushbuttonsaveplot (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[filename, pathname, filterindex] = uiputfile({'*.jpg','JPEG image (*.jpg)';...
'*.fig','MATLAB Figure (*.fig)';...
'*.png','Portable Network Graphics file (*.png)';...
'*.bmp','Bitmap file (*.bmp)';...
'*.eps','EPS file (*.eps)';...
'*.pdf','PDF (*.pdf)'}, 'Save Plot As', 'plot.jpg');
export_fig(filename, handles.Plot, '-m2');
end

採用された回答

Walter Roberson
Walter Roberson 2018 年 5 月 2 日
Before calling export_fig,
if ~ischar(filename)
return; %user cancel
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePrinting and Saving についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by