📄 setctrlr.m
字号:
%
% Syntax: ConType = setctrlr(strEvent, hConType)
%
% Inputs: strEvent is an event string, defined in the file 'pendulum.m'.
% hConType is a handle to a uicontrol
% Output: ConType is a string with a description of the controller
%
% Result: If strEvent is an event string belonging to the Simulation >
% Controller submenu, the selected menuitem is checked and the
% variable ConType is set accordingly and returned. The selected
% controller is also displayed on the main screen.
%
% Petur Snaeland, 25.04.1995
% Revised Hordur Kvaran, 20.10.97
% All global variables removed, hConType and ConType variables added as arguments
% Hordur Kvaran, 14.10.97
%
function ConType = setctrlr(strEvent,hConType)
%
% Access the global variable ConType, and load the handles
% to the menuitems created (and saved) in pendul2.m:
%
%load uihandle;
hmnuSimConLin=findobj('Tag','mnuSimConLin');
hmnuSimConRul=findobj('Tag','mnuSimConRul');
hmnuSimConTbl=findobj('Tag','mnuSimConTbl');
hmnuSimConSOC=findobj('Tag','mnuSimConSOC');
%
% Define constants for controller types:
%
CONLIN = 1; CONRUL = 2; CONTBL = 3; CONSOC = 4;
%
% Check submenu items and set ConType according to user selection:
%
if strcmp(strEvent,'SimConLin'),
set(hmnuSimConLin,'Checked','on');
set(hmnuSimConRul,'Checked','off');
set(hmnuSimConTbl,'Checked','off');
set(hmnuSimConSOC,'Checked','off');
ConType = 'Linear Summation';
elseif strcmp(strEvent,'SimConRul'),
set(hmnuSimConLin,'Checked','off');
set(hmnuSimConRul,'Checked','on');
set(hmnuSimConTbl,'Checked','off');
set(hmnuSimConSOC,'Checked','off');
ConType = 'Rule Based Fuzzy';
elseif strcmp(strEvent,'SimConTbl'),
set(hmnuSimConLin,'Checked','off');
set(hmnuSimConRul,'Checked','off');
set(hmnuSimConTbl,'Checked','on');
set(hmnuSimConSOC,'Checked','off');
ConType = 'Table Based Fuzzy';
elseif strcmp(strEvent,'SimConSOC'),
set(hmnuSimConLin,'Checked','off');
set(hmnuSimConRul,'Checked','off');
set(hmnuSimConTbl,'Checked','off');
set(hmnuSimConSOC,'Checked','on');
ConType = 'SOC on Cart';
end;
dispinfo('ConType',ConType,hConType);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -