如何在Matlab GUI上将在pushbutton1上读取的图像调用为pushbutton4?

时间:2019-05-26 06:56:07

标签: matlab matlab-guide

我在pushbutton1上执行了一个读取图像以拍照,并将使用pushbutton4对该图像进行加密处理,但是我很难将图像从pushbutton1调用到pushbutton4,请给我一个解决此问题的方法。谢谢

我在pushbutton1上尝试过

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

[namafile1, formatfile1] = uigetfile({'*.png':'*.jpg':'*.bmp'}, 'Pilih Gambar');
image1 = imread([formatfile1, namafile1]);
guidata(hObject, handles);
axes(handles.axes1);
imshow(image1); 
handles.img1 = image1;

然后我在pushbutton4上这样称呼图像

a = handles.img1;

和这样的结果

Error in untitled1>pushbutton4_Callback (line 137)
a = handles.img1;

请给我解决这个问题的方法。谢谢

0 个答案:

没有答案