gui_con1.m

来自「FISMAT accommodates different arithmetic」· M 代码 · 共 229 行

M
229
字号
function gui_con1(action,in1,in2);%# call t3mi t1bd t15ep t2ap s3ma s1bs s15es s2as s25hs% gui_con1%% GUI driven demonstration file for logical connectives.%%% FSTB - Fuzzy Systems Toolbox for MATLAB% Copyright (c) 1993-1996 by Olaf Wolkenhauer% Control Systems Centre at UMIST% Manchester M60 1QD, UK%% 21-October-19946% Last change 21/11/96%	possible actions:%	  'start'          	initialises the demo file.%	  'redraw'		following each change in menus redraw%	  'done'		exit the demo if nargin<1,    action='start';end;% Declare handles of menus global :  global CON1_Hndl CON2_Hndl% Declare axes for plots global :  global surf_axes_1 cont_axes_1 surf_axes_2 cont_axes_2oldFigNumber = [];if strcmp(action,'start'),	  % Graphics initialization  figNumber = figure;  oldFigNumber = watchon;  set(gcf, ...      'NumberTitle','off', ...      'Name','Fuzzy Logic Connectives', ...      'backingstore','off',...      'Units','normalized');  % Information for all buttons  labelColor=192/255*[1 1 1];  top=0.95; bottom=0.05;  yInitLabelPos=0.90;  left = 0.78; left_label=left-0.004;  labelWid=0.18; labelHt=0.05;  btnWid = 0.18; btnHt=0.07;  % Spacing between the label and the button for the same command  btnOffset=0.003;    % Spacing between the button and the next command's label  spacing=0.05; % vertical gap    % The CONSOLE frame  frmBorder=0.02;  yPos=0.05-frmBorder;  frmPos=[left-frmBorder yPos btnWid+2*frmBorder 0.9+2*frmBorder];  console_Hndl=uicontrol( ...    'Style','frame', ...    'Units','normalized', ...    'Position',frmPos, ...    'BackgroundColor',[0.5 0.5 0.5]);   % The CON1 command popup button/menu  btnNumber=1;  yLabelPos=top-(btnNumber-1)*(btnHt+labelHt+spacing);  % Generic label information  labelPos=[left_label yLabelPos-labelHt labelWid labelHt];  uicontrol( ...    'Style','text', ...    'Units','normalized', ...    'Position',labelPos, ...    'BackgroundColor',labelColor, ...    'HorizontalAlignment','Center', ...    'String',' Connective 1');  btnPos=[left yLabelPos-labelHt-btnHt-btnOffset btnWid btnHt];  CON1_Hndl=uicontrol( ...    'Style','Popup',...    'String','t3mi|t1bd|t15ep|t2ap|s3ma|s1bs|s15es|s2as|s25hs',...    'Units','normalized',...    'Position', btnPos, ...    'Value',[ 1 ],...    'CallBack','gui_con1(''redraw'')');   % The CON1 command popup button/menu  btnNumber=2;  yLabelPos=top-(btnNumber-1)*(btnHt+labelHt+spacing);    % Generic label information  labelPos=[left_label yLabelPos-labelHt labelWid labelHt];  uicontrol( ...    'Style','text', ...    'Units','normalized', ...    'Position',labelPos, ...    'BackgroundColor',labelColor, ...    'HorizontalAlignment','Center', ...    'String',' Connective 2');  % Generic popup button information  btnPos=[left yLabelPos-labelHt-btnHt-btnOffset btnWid btnHt];  CON2_Hndl = uicontrol( ...    'Style','popup', ...    'Units','normalized', ...    'Position',btnPos, ...    'String','s3ma|s1bs|s15es|s2as|t3mi|t1bd|t15ep|t2ap|t25hp', ...    'Value', [ 1 ], ...    'Callback','gui_con1(''redraw'')');    % The INFO button  uicontrol( ...    'Style','push', ...    'Units','normalized', ...    'Position',[left bottom+(2*labelHt)+spacing btnWid 2*labelHt], ...    'String','Info', ...    'Callback','gui_con1(''info'')');   % The CLOSE button  done_button=uicontrol('Style','Pushbutton', ...    'Position',[left bottom btnWid 2*labelHt], ...    'Units','normalized','Callback',...    'gui_con1(''done'')','String','Close');  % Create axes for plots :  surf_axes_1  = axes('Position',[.05 .58 .3 .3], ...                    'XLim',[0 1],'YLim',[0 1],'ZLim',[0 1]);  cont_axes_1 = axes('Position',[.05 .14 .3 .3], ...                   'XLim',[0 1],'YLim',[0 1]);  surf_axes_2 = axes('Position',[.42 .58 .3 .3], ...                    'XLIm',[0 1],'YLim',[0 1],'ZLim',[0 1]);  cont_axes_2 = axes('Position',[.42 .14 .3 .3], ...                    'XLIm',[0 1],'YLim',[0 1]);  gui_con1('redraw');elseif strcmp(action,'done'),  close(gcf);  clear global CON1_Hndl CON2_Hndl  clear global surf_axes_1 cont_axes_1 surf_axes_2 cont_axes_2elseif strcmp(action,'redraw'),  % recomputes outset and output value and updates display  val = get(CON1_Hndl,'Value');  if (val == 1),    CON1='t3mi';  elseif (val == 2),    CON1='t1bd';  elseif (val == 3),    CON1='t15ep';  elseif (val == 4),    CON1='t2ap';  elseif (val == 5),    CON1='s3ma';  elseif (val == 6),    CON1='s1bs';  elseif (val == 7),    CON1='s15es';  elseif (val == 8),    CON1='s2as';  elseif (val == 9),    CON1='s25hs';  end;  val = get(CON2_Hndl,'Value');  if (val == 1),    CON2='s3ma';  elseif (val == 2),    CON2='s1bs';  elseif (val == 3),    CON2='s15es';  elseif (val == 4),    CON2='s2as';  elseif (val == 5),    CON2='t3mi';  elseif (val == 6),   CON2='t1bd';  elseif (val == 7),   CON2='t15ep';  elseif (val == 8),   CON2='t2ap';  elseif (val == 9),   CON2='t25hp';  end;  resxy=20;  xvalues = 0:1/resxy:1; yvalues = xvalues;  [avalues,bvalues] = meshgrid(xvalues,yvalues);  m1 = feval(CON1,avalues,bvalues);  m2 = feval(CON2,avalues,bvalues);  watchoff(oldFigNumber);   axes(surf_axes_1);  surfc(xvalues,yvalues,m1); title('connective 1'); grid  axes(cont_axes_1);  pcolor(xvalues,yvalues,m1); xlabel('connective 1');  axes(surf_axes_2);  surfc(xvalues,yvalues,m2); title('connective 2'); grid  axes(cont_axes_2);  pcolor(xvalues,yvalues,m2); xlabel('connective 2');  drawnow elseif strcmp(action,'info'),  ttlStr = 'Fuzzy Logic Connectives';   hlpStr1= ...                                                  ['  						  '];  hlpStr2= ...                                                   ['  						  '];  hlpStr3= str2mat(...                       ' ', ...    ' File name: gui_con1.m');  helpfun(ttlStr, hlpStr1, hlpStr2, hlpStr3);end; % of gui_con1.m

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?