필터 지우기
필터 지우기

how to use the pop up menu in gui which contains "Yes" and "No", then linked to pushbutton

조회 수: 1 (최근 30일)
function pushbutton_Callback(hObject, eventdata, handles)
% hObject handle to lanjut (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
a=readfis('coba2');
out=evalfis([handles.G01 handles.G02 handles.G03 handles.G04 handles.G05 handles.G06 handles.G07 handles.G08
handles.G09 handles.G10 handles.G11 handles.G12 handles.G13 handles.G14 handles.G15 handles.G16, a]);
set(handles.hasil,'string',out);
% --- Executes on selection change in popupmenuG01.
function popupmenu_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
contents = get(handles.popupmenu,'String');
popupmenuvalue = contents{get(handles.popupmenu,'Value')};
guidata(hObject, popupmenuvalue);
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenuG01 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenuG01
% --- Executes during object creation, after setting all properties.
function popupmenuG01_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenuG01 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

답변 (1개)

Zuliana Nurfadlillah
Zuliana Nurfadlillah 2019년 12월 29일
yes this is a bit of my program code, but when I run there is an error like this
Attempt to reference field of non-structure array.
Error in User_Detection_Advanced_METER_GAUGE> popupmenuG02_Callback (line 188)
contents = get (handles.popupmenuG02, 'String');
Error in gui_mainfcn (line 96)
        feval (varargin {:});
Error in User_Detection_Continuation_GAUGE (line 42)
    gui_mainfcn (gui_State, varargin {:});
Error in @ (hObject, eventdata) User_Detection_METER_GAUGE ('popupmenuG02_Callback', hObject, eventdata, guidata (hObject))
 
Error while evaluating Callback uicontrol

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by