📄 nefgui_o.m
字号:
NofLines = 5;
left = left;
height = NofLines*(Nspacing+NbtnHt) + Nspacing;
top = bottom - Nspacing;
width = width;
right = left+width;
bottom = top-height;
topFrmHndl=uicontrol(h, ...
'Style','frame', ...
'Units','normalized', ...
'Position', [left bottom width height], ...
'BackgroundColor',frmColor);
statHndl=uicontrol(h, ...
'Style','text', ...
'BackgroundColor',frmColor, ...
'HorizontalAlignment','center', ...
'Position', [left+Nspacing top-Nspacing-NbtnHt width-2*Nspacing NbtnHt], ...
'Units', 'normalized', ...
'String', 'Optimization');
optH=uicontrol(h, ...
'Style','popup', ...
'BackgroundColor',editColor, ...
'Position', [left+Nspacing top-2*(Nspacing+NbtnHt) width-3*Nspacing-NbtnHt NbtnHt], ...
'Units', 'normalized', ...
'String', 'Nefcon I (modified)|Nefcon II|disabled',...
'CallBack', 'nefgui_o(''opt'')', ...
'Tag', 'opt');
helpb = uicontrol(h, ...
'Style', 'push', ...
'String', '?', ...
'Units','normalized', ...
'Position', [left+width-Nspacing-NbtnHt top-2*(Nspacing+NbtnHt) NbtnHt NbtnHt], ...
'CallBack', 'hthelp(''nefcon.htm#optopt'')');
% sigmaH=uicontrol(h, ...
% 'Style','slider', ...
% 'BackgroundColor',editColor, ...
% 'Position', [left+Nspacing top-4*(Nspacing+NbtnHt) width-2*Nspacing NbtnHt], ...
% 'Units', 'normalized', ...
% 'Min', 0, 'Max', 1, 'Value', 0.1);
statHndl=uicontrol(h, ...
'Style','text', ...
'BackgroundColor',frmColor, ...
'HorizontalAlignment','left', ...
'Position', [left+Nspacing top-3*(Nspacing+NbtnHt) width/3-2*Nspacing NbtnHt], ...
'Units', 'normalized', ...
'String', 'learn. rate:');
rateH=uicontrol(h, ...
'Style','edit', ...
'BackgroundColor',editColor, ...
'Position', [left+width/3+Nspacing top-3*(Nspacing+NbtnHt) width*0.2 NbtnHt], ...
'Units', 'normalized',...
'CallBack', 'nefgui_o(''rate'')', ...
'Tag', 'rate');
% sh=uicontrol(h, ...
% 'Style','frame', ...
% 'Units','normalized', ...
% 'Position',[left+Nspacing/2 bottom+Nspacing/2 width-Nspacing 2*(Nspacing+NbtnHt)], ...
% 'BackgroundColor',frmColor);
addrH=uicontrol(h, ...
'Style','checkbox', ...
'BackgroundColor',frmColor, ...
'Position', [left+Nspacing top-4*(Nspacing+NbtnHt) width-2*Nspacing NbtnHt], ...
'Units', 'normalized', ...
'String', 'add rules during Optimization', ...
'CallBack', 'nefgui_o (''addr'')', ...
'Tag','addr');
sH=uicontrol(h, ...
'Style','text', ...
'BackgroundColor',frmColor, ...
'HorizontalAlignment','left', ...
'Position', [left+Nspacing top-5*(Nspacing+NbtnHt) width/5-1*Nspacing NbtnHt], ...
'Units', 'normalized', ...
'String', 'optimize:');
obndH=uicontrol(h, ...
'Style','edit', ...
'BackgroundColor',editColor, ...
'Position', [left+Nspacing+width/5 top-5*(Nspacing+NbtnHt) width/5-1*Nspacing NbtnHt], ...
'Units', 'normalized', ...
'CallBack', 'nefgui_o (''obnd'')', ...
'Tag','obnd');
obtH=uicontrol(h, ...
'Style','popup', ...
'BackgroundColor',editColor, ...
'Position', [left+width*0.4+Nspacing top-5*(Nspacing+NbtnHt) width*0.6-2*Nspacing NbtnHt], ...
'Units', 'normalized', ...
'String', 'time steps [s]|iteration steps|cycles',...
'CallBack', 'nefgui_o (''obt'')', ...
'Tag', 'obt');
% Setting global defaults - check if already set
nefdef;
if NEFCON_STAT == [],
NEFCON_STAT = 0;
end
% set actual values
nefgui_o('actualize');
elseif strcmp(action, 'close'),
% close current nefgui_o
set(handle,'visible','off');
% close(gcf);
elseif strcmp(action, 'status'),
if nargin < 2,
p1 = '';
end
hndl=findobj(handle, 'Tag','status');
if hndl ~= [],
set(hndl, 'String', p1);
end
elseif strcmp(action, 'rulelist'),
hndl=findobj(handle, 'Tag', 'rulelist');
if hndl ~= [],
if NEFCON_STAT == 0,
NEFCON_RULE = get(hndl, 'Value');
if NEFCON_RULE == 1
NEFCON_RRATE = 1.0;
elseif NEFCON_RULE == 2
NEFCON_RRATE = 0.2;
end
tagset(handle, 'rlr', 'String', num2str(NEFCON_RRATE));
else
disp('NEFCON: Could not change rule-learning during execution.');
set(hndl, 'Value', NEFCON_RULE);
end
end
elseif strcmp(action, 'opt'),
hndl=findobj(handle, 'Tag', 'opt');
if hndl ~= [],
if NEFCON_STAT == 0,
NEFCON_OPT = get(hndl, 'Value');
else
nefgui_o('status', 'INFORMATION: optimization type changed.');
NEFCON_OPT = get(hndl, 'Value');
% disp('NEFCON: Could not change optimization type during execution.');
% set(hndl, 'Value', NEFCON_OPT);
end
end
elseif strcmp(action, 'inifismat'),
hndl=findobj(handle, 'Tag', 'inifismat');
if hndl ~= [],
if NEFCON_STAT == 0,
NEFCON_IFM = get(hndl, 'String');
else
disp('NEFCON: Could not change initial fismatrix during execution.');
set(hndl, 'String', NEFCON_IFM);
end
end
elseif strcmp(action, 'rate'),
hndl=findobj(handle, 'Tag', 'rate');
if hndl ~= [],
data = str2num(get(hndl, 'String'));
if data<0,
nefgui_o('status', 'ERROR: Rate must be positive.')
set(hndl, 'String', num2str(NEFCON_RATE));
else
NEFCON_RATE = data;
if NEFCON_STAT > 0,
nefgui_o('status', 'INFORMATION: Rate changed.');
end
end
end
elseif strcmp(action, 'rbnd'),
hndl=findobj(handle, 'Tag', 'rbnd');
if hndl ~= [],
data = str2num(get(hndl, 'String'));
if data<0,
nefgui_o('status', 'ERROR: Number must be positive.')
set(hndl, 'String', num2str(NEFCON_RBND));
else
NEFCON_RBND = data;
if NEFCON_STAT > 0,
nefgui_o('status', 'INFORMATION: changed.');
end
end
nefgui('cycles', 'set');
end
elseif strcmp(action, 'rbt'),
hndl=findobj(handle, 'Tag', 'rbt');
if hndl ~= [],
if NEFCON_STAT == 0,
NEFCON_RBT = get(hndl, 'Value');
else
nefgui_o('status', 'INFORMATION: units changed.');
NEFCON_RBT = get(hndl, 'Value');
end
nefgui('cycles', 'set');
end
elseif strcmp(action, 'rbnd1'),
hndl=findobj(handle, 'Tag', 'rbnd1');
if hndl ~= [],
data = str2num(get(hndl, 'String'));
if data<0,
nefgui_o('status', 'ERROR: Number must be positive.')
set(hndl, 'String', num2str(NEFCON_RBND1));
else
NEFCON_RBND1 = data;
if NEFCON_STAT > 0,
nefgui_o('status', 'INFORMATION: changed.');
end
end
nefgui('cycles', 'set');
end
elseif strcmp(action, 'rbt1'),
hndl=findobj(handle, 'Tag', 'rbt1');
if hndl ~= [],
if NEFCON_STAT == 0,
NEFCON_RBT1 = get(hndl, 'Value');
else
nefgui_o('status', 'INFORMATION: units changed.');
NEFCON_RBT1 = get(hndl, 'Value');
end
nefgui('cycles', 'set');
end
elseif strcmp(action, 'obnd'),
hndl=findobj(handle, 'Tag', 'obnd');
if hndl ~= [],
data = str2num(get(hndl, 'String'));
if data<0,
nefgui_o('status', 'ERROR: Number must be positive.')
set(hndl, 'String', num2str(NEFCON_OBND));
else
NEFCON_OBND = data;
if NEFCON_STAT > 0,
nefgui_o('status', 'INFORMATION: changed.');
end
end
nefgui('cycles', 'set');
end
elseif strcmp(action, 'obt'),
hndl=findobj(handle, 'Tag', 'obt');
if hndl ~= [],
if NEFCON_STAT == 0,
NEFCON_OBT = get(hndl, 'Value');
else
nefgui_o('status', 'INFORMATION: units changed.');
NEFCON_OBT = get(hndl, 'Value');
% disp('NEFCON: Could not change units during execution.');
% set(hndl, 'Value', NEFCON_OBT);
end
nefgui('cycles', 'set');
end
elseif strcmp(action, 'actualize'),
% set button states
if NEFCON_FIS == []
str = 'off';
else
str = 'on';
end
tagset(handle, 'showb', 'enable', str);
tagset(handle, 'editb', 'enable', str);
tagset(handle, 'editR', 'enable', str);
tagset(handle, 'showS', 'enable', str);
tagset(handle, 'rulelist', 'Value', NEFCON_RULE);
tagset(handle, 'opt', 'Value', NEFCON_OPT);
tagset(handle, 'rate', 'String', num2str(NEFCON_RATE));
tagset(handle, 'inifismat', 'String', NEFCON_IFM);
tagset(handle, 'rbt', 'Value', NEFCON_RBT);
tagset(handle, 'rbnd', 'String', num2str(NEFCON_RBND));
tagset(handle, 'rbt1', 'Value', NEFCON_RBT1);
tagset(handle, 'rbnd1', 'String', num2str(NEFCON_RBND1));
tagset(handle, 'obt', 'Value', NEFCON_OBT);
tagset(handle, 'obnd', 'String', num2str(NEFCON_OBND));
tagset(handle, 'partin', 'String', num2str(NEFCON_MFIN));
tagset(handle, 'partout', 'String', num2str(NEFCON_MFOUT));
tagset(handle, 'mfit', 'Value', NEFCON_MFIT);
tagset(handle, 'mfot', 'Value', NEFCON_MFOT);
tagset(handle, 'noise', 'Value', NEFCON_GENN);
tagset(handle, 'addr', 'Value', NEFCON_ADDR);
tagset(handle, 'rlr', 'String', num2str(NEFCON_RRATE));
tagset(handle, 'rrm', 'String', num2str(NEFCON_RPER));
elseif strcmp(action, 'partin'),
hndl=findobj(handle, 'Tag', 'partin');
if hndl ~= [],
data = str2num(get(hndl, 'String'));
if data<0 | NEFCON_STAT > 0,
nefgui_o('status', 'ERROR: Number must be positive or illegal status.')
set(hndl, 'String', num2str(NEFCON_MFIN));
else
NEFCON_MFIN = data;
end
end
elseif strcmp(action, 'partout'),
hndl=findobj(handle, 'Tag', 'partout');
if hndl ~= [],
data = str2num(get(hndl, 'String'));
if data<0 | NEFCON_STAT > 0,
nefgui_o('status', 'ERROR: Number must be positive or illegal status.')
set(hndl, 'String', num2str(NEFCON_MFOUT));
else
NEFCON_MFOUT = data;
end
end
elseif strcmp(action, 'mfit'),
hndl=findobj(handle, 'Tag', 'mfit');
if hndl ~= [],
if NEFCON_STAT == 0,
NEFCON_MFIT = get(hndl, 'Value');
else
nefgui_o('status', 'INFORMATION: units changed.');
NEFCON_MFIT = get(hndl, 'Value');
end
end
elseif strcmp(action, 'mfot'),
hndl=findobj(handle, 'Tag', 'mfot');
if hndl ~= [],
if NEFCON_STAT == 0,
NEFCON_MFOT = get(hndl, 'Value');
else
nefgui_o('status', 'INFORMATION: units changed.');
NEFCON_MFOT = get(hndl, 'Value');
end
end
elseif strcmp(action, 'noise'),
hndl=findobj(handle, 'Tag', 'noise');
if hndl ~= [],
if NEFCON_STAT ~= 0,
nefgui_o('status', 'INFORMATION: value changed.');
end
NEFCON_GENN = get(hndl, 'Value');
if NEFCON_STAT == 2 | NEFCON_STAT == 3
NEFCON_NOISE = NEFCON_GENN;
end
end
elseif strcmp(action, 'addr'),
hndl=findobj(handle, 'Tag', 'addr');
if hndl ~= [],
if NEFCON_STAT ~= 0,
nefgui_o('status', 'INFORMATION: value changed.');
end
NEFCON_ADDR = get(hndl, 'Value');
end
elseif strcmp(action, 'rlr'),
hndl=findobj(handle, 'Tag', 'rlr');
if hndl ~= [],
data = str2num(get(hndl, 'String'));
if data<0,
nefgui_o('status', 'ERROR: Rate must be positive.')
set(hndl, 'String', num2str(NEFCON_RRATE));
else
NEFCON_RRATE = data;
if NEFCON_STAT > 0,
nefgui_o('status', 'INFORMATION: Rate changed.');
end
end
end
elseif strcmp(action, 'rrm'),
hndl=findobj(handle, 'Tag', 'rrm');
if hndl ~= [],
data = str2num(get(hndl, 'String'));
if data<0,
nefgui_o('status', 'ERROR: Rate must be positive.')
set(hndl, 'String', num2str(NEFCON_RPER));
else
NEFCON_RPER = data;
if NEFCON_STAT > 0,
nefgui_o('status', 'INFORMATION: Value changed.');
end
end
end
elseif strcmp(action, ''),
% popup window
nefgui_o('actualize');
set(handle,'visible','on');
figure(handle);
else
disp(['nefgui_o: illegal action (' action ')']);
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -