for pushbutton5 (reffered as Print) where on clicking the pushbutton5 graph should print and save the graph. Thanks
Unable to Print Graph being Generated in axes.handle4
1 次查看(过去 30 天)
显示 更早的评论
Hi,
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
plot(handles.axes4)
The above code i want to use to print graph generated in handles.axes4. But i am unable to do so. What will be the solution. I have attached a screenshot, for pushbutton5 (reffered as Print) where on clicking the pushbutton5 graph should plot. Thanks
采纳的回答
Walter Roberson
2021-3-9
You posted that you tried
saveas(handles.axes4)
but you would need
[file,filepath] = uiputfile('*.jpg');
if ~ischar(file); return; end %user cancel
filename = fullfile(filepath, file);
saveas(handles.axes4,filename);
However, to save just the axes, you should use the new https://www.mathworks.com/help/matlab/ref/exportgraphics.html (R202a or later), or use the File Exchange contribution export_fig if you have an older MATLAB than that.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!