📄 control.m
字号:
%-------------------------------------------------------------------------------% INITIATE CONTROL FIGURE%-------------------------------------------------------------------------------global initx;
hFig = findobj( allchild(0), 'Name', 'HSP Control Center' );% If GUI already exists, bring it to front and escapeif ~isempty(hFig), set(0,'CurrentFigure',hFig); returnend% Time to make a new figure% Warn user of possible delaydisp('Building HSP Control Interface...')
HspSaveCmdC = ['save hsp_control ',...
'Pn fmin fmax ka touz toup fes1 fes0 kes fesmin fev0 fev1 kev fcs0 ',...
'Gx toux Dx initx'];
%------------------------------------------------------------------------------% Load Hsp control data -- if not available, Define default parameters%------------------------------------------------------------------------------ if exist('hsp_control.mat') == 2; load hsp_control.mat; else %display info message fprintf('\nDefault settings being saved as ''hsp_control.mat...'' \n'); % Initialize variables
%Carotid sinus afferent pathway
Pn=92;
fmin=2.52;
fmax=47.78;
ka=11.758;
touz=6.37;
toup=2.076;
%Sympathetic efferent pathway
fes1=2.10;
fes0=16.11;
kes=0.0675;
fesmin=2.66;
%Vagal efferent pathway
fev0=3.2;
fev1=6.3;
kev=7.06;
fcs0=25;
% Initialize Effector Parameters
%
% Emaxlv Emaxrv Rsp Rep Vusv Vuev Ts Tv % 1 2 3 4 5 6 7 8
Gx = [0.475 0.282 0.695 0.53 -265.4 -132.5 -0.13 0.09]'; toux = [ 8 8 6 6 20 20 2 1.5 ]'; Dx = [ 2 2 2 2 5 5 2 0.2 ]';
% Initial conditions initx = [2.392 1.412 2.49 0.78 1435.4 1537 0.58 0]';
% Save Data
save hsp_control Pn fmin fmax ka touz toup ...
fes1 fes0 kes fesmin fev0 fev1 kev fcs0 ...
Gx toux Dx initx
end
load Control
%Main Window
h0 = figure('Color',[0.8 0.8 0.8], ...
'Colormap',mat0, ...
'FileName','D:\MATLAB\work\Control.m', ...
'Name','HSP Control Center', ...
'NumberTitle','off', ...
'PaperPosition',[18 180 576.0000000000001 432.0000000000002], ...
'PaperUnits','points', ...
'Position',[1 1 800 552], ...
'Tag','HspC', ...
'ToolBar','none');
%Title Label
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'FontName','Geneva', ...
'FontSize',20, ...
'FontWeight','bold', ...
'ListboxTop',0, ...
'Position',[57.7241379310345 281.1034482758622 308.4827586206897 39.10344827586208], ...
'String','HSP Control Center', ...
'Style','text', ...
'Tag','StaticText1');
%Save Button
h1 = uicontrol('Parent',h0, ...
'Style', 'pushbutton', ...
'String', 'Save', ...
'Units', 'points', ...
'Position',[422.0689655172415 63.31034482758622 45.31034482758621 19.86206896551725], ...
'Callback', HspSaveCmdC, ...
'Tag', 'SaveBtn');
%Reset Button
h1 = uicontrol('Parent',h0, ...
'Style', 'pushbutton', ...
'String', 'Reset', ...
'Units', 'points', ...
'Position',[423.3103448275863 33.51724137931035 45.31034482758621 19.86206896551725], ...
'Callback', 'delete(gcf); Control;', ... , ...
'Tag', 'ResetBtn');
%Carotid sinus afferent pathway
%Pn
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
'ListboxTop',0, ...
'Position',[19.24137931034483 257.5862068965518 22.96551724137932 12.41379310344828], ...
'String','Pn', ...
'Style','text', ...
'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[1 1 1], ...
'ListboxTop',0, ...
'Position',[52.13793103448277 258.2068965517242 36.00000000000001 16.75862068965517], ...
'String',eval('num2str(Pn)'), ...
'Callback','Pn=str2num(get(gcbo, ''String''));', ...
'Style','edit', ...
'Tag','EditText1');
%fmin
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[1 1 1], ...
'ListboxTop',0, ...
'Position',[131.1724137931035 257.5862068965518 36.00000000000001 16.75862068965517], ...
'String',eval('num2str(fmin)'), ...
'Callback','fmin=str2num(get(gcbo, ''String''));', ...
'Style','edit', ...
'Tag','EditText1');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
'ListboxTop',0, ...
'Position',[98.20689655172416 257.5862068965518 22.96551724137932 12.41379310344828], ...
'String','fmin', ...
'Style','text', ...
'Tag','StaticText2');
%fmax
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
'ListboxTop',0, ...
'Position',[177.1724137931035 257.5862068965518 22.96551724137932 12.41379310344828], ...
'String','fmax', ...
'Style','text', ...
'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[1 1 1], ...
'ListboxTop',0, ...
'Position',[210.1379310344828 257.5862068965518 36.00000000000001 16.75862068965517], ...
'String',eval('num2str(fmax)'), ...
'Callback','fmax=str2num(get(gcbo, ''String''));', ...
'Style','edit', ...
'Tag','EditText1');
%ka
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[1 1 1], ...
'ListboxTop',0, ...
'Position',[289.1034482758621 257.5862068965518 36.00000000000001 16.75862068965517], ...
'String',eval('num2str(ka)'), ...
'Callback','ka=str2num(get(gcbo, ''String''));', ...
'Style','edit', ...
'Tag','EditText1');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
'ListboxTop',0, ...
'Position',[256.1379310344828 257.5862068965518 22.96551724137932 12.41379310344828], ...
'String','ka', ...
'Style','text', ...
'Tag','StaticText2');
%touz
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
'ListboxTop',0, ...
'Position',[414.0689655172414 257.5862068965518 22.96551724137932 12.41379310344828], ...
'String','touz', ...
'Style','text', ...
'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[1 1 1], ...
'ListboxTop',0, ...
'Position',[447.0344827586207 257.5862068965518 36.00000000000001 16.75862068965517], ...
'String',eval('num2str(touz)'), ...
'Callback','touz=str2num(get(gcbo, ''String''));', ...
'Style','edit', ...
'Tag','EditText1');
%toup
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
'ListboxTop',0, ...
'Position',[335.1034482758621 257.5862068965518 22.96551724137932 12.41379310344828], ...
'String','toup', ...
'Style','text', ...
'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[1 1 1], ...
'ListboxTop',0, ...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -