From: Markus on
I have a matlab gui running, that outputs a FFT plot on an axes. I want to save this plot for future reference and tried using this following code. How ever it gives me the following error:

??? Error using ==> copyobj
Conversion to double from struct is not possible.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function uipushtool3_ClickedCallback(hObject, eventdata, handles)
% hObject handle to uipushtool3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

plotH = get(handles.axes2);
orignalAxes = gca;
% uicontrol('parent',gcf)


%Create a ne figure
newFig = figure(2);
%Create a copy of the axes
newA = copyobj(orignalAxes,newFig);
%copy the plot across
newPlotH = copyobj(plotH,newA);

%Print the fig with the print function
print(newFig,'-dpng','image.png');
%close the new figure
close(newPlotH)
guidata(hObject,handles);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Does anyone have an idea to get around this error or help me saving my plot? Any help will be appreciated.

Thanks, Markus
 | 
Pages: 1
Prev: plotting two matrices
Next: Matlab DAQ issues