GUI: OpeningFcn problem
显示 更早的评论
Hey there! I'm encountering a little problem with my GUI.
Goal: 3 panels disabled by default (when I open the GUI figure) and one of them enables when I select one of three radio buttons.
Problem: This works perfectly well when I run my GUI.m code but it shows an error when I try it by opening the GUI.fig.
OpeningFcn:
function GUI_OpeningFcn(hObject, eventdata, handles, varargin)
set(findall(handles.panel1,'-property','enable'),'enable','off');
set(findall(handles.panel2,'-property','enable'),'enable','off');
set(findall(handles.panel3,'-property','enable'),'enable','off');
handles.output = hObject;
guidata(hObject, handles);
SelectionChangeFcn:
function RadioPanel_SelectionChangeFcn(hObject, eventdata, handles)
switch hObject
case handles.radiobutton1
set(findall(handles.panel1, '-property', 'enable'), 'enable', 'off');
set(findall(handles.panel2, '-property', 'enable'), 'enable', 'off');
set(findall(handles.panel3, '-property', 'enable'), 'enable', 'on');
case handles.radiobutton2
set(findall(handles.panel1, '-property', 'enable'), 'enable', 'on');
set(findall(handles.panel2, '-property', 'enable'), 'enable', 'off');
set(findall(handles.panel3, '-property', 'enable'), 'enable', 'off');
case handles.radiobutton3
set(findall(handles.panel1, '-property', 'enable'), 'enable', 'off');
set(findall(handles.panel2, '-property', 'enable'), 'enable', 'on');
set(findall(handles.panel3, '-property', 'enable'), 'enable', 'off');
end
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Update figure-Based Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!