Unable to Print Graph being Generated in axes.handle4
Show older comments
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
9 Comments
Avinav Kumar
on 9 Mar 2021
Walter Roberson
on 9 Mar 2021
You should be calling print() not plot() there.
But are you sure you want to send to the printer, rather than saving to a file with saveas() ?
Avinav Kumar
on 9 Mar 2021
Avinav Kumar
on 9 Mar 2021
Walter Roberson
on 9 Mar 2021
You need to supply a filename to save into.
Avinav Kumar
on 9 Mar 2021
Walter Roberson
on 9 Mar 2021
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);
Avinav Kumar
on 9 Mar 2021
Avinav Kumar
on 9 Mar 2021
Accepted Answer
More Answers (0)
Categories
Find more on Creating, Deleting, and Querying Graphics Objects 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!