目测没有问题 别说你在fig中没有画出axes1的位置
function pushbutton1_Callback(hObject, eventdata, handles)
global im
[filename pathname] = ...
uigetfile({'*.jpg';'*.bmp';'*.gif'}, '开始');
str=[pathname filename];
im=imread(str);
axes(handles.axes1);
imshow(im);
这段代码可以实现:
[filename pathname]=uiputfile({'*.jpg','jpg file(*.jpg)');
str = [pathname filename];
strBefore = str(1:end-4);
strEx = str(end-3 : end);
figure('visible', 'off');
strcmp(strEx, '.jpg')
fullName = [strBefore,'.jpg'];
h=get(handles.axes1,'children');
figure('visible','off');
axes;
copyobj(h,gca)
print(gcf,'-dmeta',fullName)