Hi,
I have referred this examples to save the current result as .jpeg on axes in GUI MATLAB. It save the current result of the axes in the current file, however it appeared some error/warning on the command window:
This is the code that I used in the push button callback function:
% --- Executes on button press in save_pushbutton.
function save_pushbutton_Callback(hObject, eventdata, handles)% hObject handle to save_pushbutton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
newfig1 = figure('Visible','off'); copyobj(handles.image_axes, newfig1);new = print('-djpeg',newfig1);saveDataName = fullfile(path1,filename1); saveas(new,saveDataName,'jpeg');
and the error is:
Error while evaluating uicontrol CallbackWarning: Files produced by the 'jpeg' driver cannot be sent to printer.File saved to disk under name 'figure20.jpg'. > In graphics\private\name at 74 In print at 206 In Noninvasive_ERT_new3>save_pushbutton_Callback at 158 In gui_mainfcn at 96 In Noninvasive_ERT_new3 at 42 In @(hObject,eventdata)Noninvasive_ERT_new3('save_pushbutton_Callback',hObject,eventdata,guidata(hObject)) Error in print (line 160) [pj, inputargs] = LocalCreatePrintJob(varargin{:});Output argument "varargout" (and maybe others) not assigned during call to "C:\ProgramFiles\MATLAB\R2011b\toolbox\matlab\graphics\print.m>print".Error in Noninvasive_ERT_new3>save_pushbutton_Callback (line 158)new = print('-djpeg',newfig1);Error in gui_mainfcn (line 96) feval(varargin{:});Error in Noninvasive_ERT_new3 (line 42) gui_mainfcn(gui_State, varargin{:});Error in@(hObject,eventdata)Noninvasive_ERT_new3('save_pushbutton_Callback',hObject,eventdata,guidata(hObject))Error while evaluating uicontrol Callback helpUtils.errorDocCallback('@(hObject,eventdata)Noninvasive_ERT_new3('save_pushbutton_Callback',hObject,eventdata,guidata(hObject))') | Error: Unexpected MATLAB expression.
Thus, could anybody help me to overcome the problem?Tq
Best Answer