How to call pop-up-menu call back in Pushbutton???
이전 댓글 표시
Hi I'm making my Gui to classify images. For this purpose i'm using two methods Neural network (NN) and kth nearest neighborhood (KNN) method for that i used popupmenu to select one of the method.. But problem is that i'm forming handles field in opening function. By using these fields I initially display image using popupmenu. If I select Knn method it display Knn image But Problem is that when I select NN method it donot display NN image but I want to display it. The opening function code and popup menu code is given as if true function sabih_expression_OpeningFcn(hObject, eventdata, handles, varargin)% code O5=imread('k-nn.png'); handles.KNN=O5; handles.main=handles.KNN; O6=imread('nn.png'); handles.NN=O6; handles.nnet=handles.NN; handles.output = hObject; guidata(hObject, handles); end
and pop up menu code is
if true
function method_popup_Callback(hObject, eventdata, handles) % code
% hObject handle to method_popup (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns method_popup contents as cell array
% contents{get(hObject,'Value')} returns selected item from method_popup
val=get(hObject,'Value');
str=get(hObject,'String');
switch str{val};
case 'KNN'
handles.main=handles.KNN;
a=handles.main;
imshow(a,'parent',handles.axes4);
case 'NN'
handles.nnet=handles.NN;
b=handles.nnet;
imshow(b,'parent',handles.axes4);
end guidata(hObject, handles); % code end
it displays image when I select Knn but donot display image when I select NN.
2ndly how can I use call back of popupmenu in pushbutton.. (As im new gui programmer)
I have two pushbuttons When execute knn data and other execute NN data. I want to use button such that when I select knn in popup menu then only Knn pushbutton works if NN pushbutton is pushed when knn is selected it displays warning...
Thanks If someone help me out I shall be very thankful.....
Regards
Ali Ahmed
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!