フィルターのクリア

Updating a GUI image (axes) from external function

1 回表示 (過去 30 日間)
mat
mat 2016 年 2 月 3 日
編集済み: mat 2016 年 2 月 9 日
Hey,
I want to update an image in the GUI from an external function. What I've found:
handles.image = image;
guidata(handles.axes1,handles.image??)
Axes has no callback function so I don't know where to start. And how do I specify which GUI I want to update?

採用された回答

mat
mat 2016 年 2 月 9 日
編集済み: mat 2016 年 2 月 9 日
imagesc(image, 'Parent', handles.axes1) solved my problem.

その他の回答 (1 件)

Subin Kuttappan Stellal Mary
Subin Kuttappan Stellal Mary 2016 年 2 月 9 日
By 'external function', do you mean any callback function? We can replace the image using callbacks in GUIDE.
I created a new GUI using GUIDE with an axes and two Push Buttons and added the following callbacks for the buttons.(I have attached the files for your reference)
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
I = imread('rice.png');
axes(handles.axes1);
imshow(I);
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
I = imread('saturn.png');
axes(handles.axes1);
imshow(I);
When you click pushbutton1, 'rice.png' will be displayed. The image will be replaced with 'saturn.png' when pushbutton2 is clicked.
  1 件のコメント
mat
mat 2016 年 2 月 9 日
I just mean a Matlab function. I found out that you can use 'Parent' for this. for example: imagesc(image, 'Parent', handles.axes1)
Thank you anyway

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by