error message Conversion to logical from matlab.gra​phics.Grap​hicsPlaceh​older is not possible

13 views (last 30 days)
i have error message" Conversion to logical from matlab.graphics.GraphicsPlaceholder is not possible" , i use matlab 2015a
Error in fuzzy2 (line 52)
while findobj(0,'Type','figure','Name',figName),
while runing this code
function fuzzy2(action);
%FUZZY Basic FIS editor.
% The FIS Editor displays high-level information about a
% Fuzzy Inference System. At the top is a diagram of the
% system with each input and output clearly labeled. By
% double-clicking on the input or output boxes, you can bring
% up the Membership Function Editor. Double-clicking on the
% fuzzy rule box in the center of the diagram will bring up
% the Rule Editor.
%
% Just below the diagram is a text field that displays the
% name of the current FIS. In the lower left of the window are
% a series of popup menus that allow you to specify the various
% functions used in the fuzzy implication process. In the lower
% right are fields that provide information about the current
% variable. The current variable is determined by clicking once
% on one of the input or output boxes.
%
% See also MFEDIT, RULEEDIT, RULEVIEW, SURFVIEW, ANFISEDIT.
% Kelly Liu 7-10-96 Ned Gulley, 4-30-94
% Copyright (c) 1994-98 by The MathWorks, Inc.
% $Revision: 1.32 $ $Date: 1998/09/03 14:17:14 $
% The # symbol is used to mark all callbacks into this function
selectColor=[1 0.3 0.3];
if nargin<1,
newFis=newfis2('Untitled','mamdani');
newFis=addvar2(newFis,'input','input1',[0 1]);
newFis=addvar2(newFis,'Output','output1',[0 1]);
action=newFis;
end
if isstr(action),
if action(1)~='#',
% The string "action" is not a switch for this function,
% so it must be a disk file
fis=readfis2(action);
action='#initialize';
end
else
% For initialization, the fis matrix is passed in as the parameter
fis=action;
action='#initialize';
end;
if strcmp(action,'#initialize'),
% Detect any FIS Editors out there with exactly the same name
fisName=fis.name;
figName=['Interval Type-2 FIS Editor: ' fisName];
while findobj(0,'Type','figure','Name',figName),
nameLen=length(fisName);
lastChar=fisName(nameLen);
if abs(lastChar)>47 & abs(lastChar)<58,
fisName(nameLen)=lastChar+1;
else
fisName=[fisName '2'];
end
fis.name=fisName;
figName=['Interval Type-2 FIS Editor: ' fisName];
end
fisType=fis.type;
if isfield(fis, 'input')
NumInputs=length(fis.input);
else
NumInputs=0;
end
if isfield(fis, 'output')
NumOutputs=length(fis.output);
else
NumOutputs=0;
end
if isfield(fis, 'rule')
NumRules=length(fis.rule);
else
NumRules=0;
end
%===================================
% Information for all objects
frmColor=192/255*[1 1 1];
btnColor=192/255*[1 1 1];
popupColor=192/255*[1 1 1];
editColor=255/255*[1 1 1];
border=6;
spacing=6;
figPos=get(0,'DefaultFigurePosition');
maxRight=figPos(3);
maxTop=figPos(4);
btnWid=110;
btnHt=23;
%====================================
% The FIGURE
thisfis{1}=fis;
figNumber=figure( ...
'Name',figName, ...
'NumberTitle','off', ...
'Color',[ .7216 .7216 .9961 ], ...
'Visible','off', ...
'MenuBar','none', ...
'UserData',thisfis, ...
'Units','pixels', ...
'DefaultAxesXColor','black', ...
'DefaultAxesYColor','black', ...
'Position',figPos, ...
'Tag','fuzzy2', ...
'ButtonDownFcn','fuzzy2 #deselect', ...
'KeyPressFcn','fuzzy2 #keypress');
figPos=get(figNumber,'position');
%====================================
% The MENUBAR items
% First create the menus standard to every GUI
fisgui2 #initialize
editHndl=findobj(figNumber,'Type','uimenu','Tag','editmenu');
uimenu(editHndl,'Label','Add input', ...
'Tag','input', ...
'Callback','fuzzy2 #addvar');
uimenu(editHndl,'Label','Add output', ...
'Tag','Output', ...
'Callback','fuzzy2 #addvar');
[labelStr,accelStr]=menulabel('&Remove variable ^x');
uimenu(editHndl,'Label',labelStr, ...
'Accelerator',accelStr, ...
'Tag','removevar', ...
'Enable','off', ...
'Callback','fuzzy2 #rmvar');
[labelStr,accelStr]=menulabel('&Undo ^z');
uimenu(editHndl,'Label','Undo', ...
'Enable','off', ...
'Tag','undo', ...
'Accelerator',accelStr, ...
'Callback','popundo2(gcf)');
%====================================
% The AXES frame
top=maxTop-(9*border);
bottom=border+7*btnHt+10*spacing;
right=maxRight-border;
left=border;
axBorder=spacing;
axPos=[left-axBorder bottom-0.5*axBorder ...
right-left+axBorder*2 top-bottom+axBorder*2];
axHndl=axes( ...
'Box','on', ...
'Units','pixels', ...
'Position',axPos, ...
'Tag','mainaxes', ...
'Visible','on');
%====================================
% The TOP frame
top=border+7*btnHt+39*spacing;
bottom=top-btnHt;
right=maxRight-border-spacing;
left=border+spacing;
frmBorder=spacing;
frmPos=[left-frmBorder bottom-frmBorder ...
right-left+frmBorder*2 top-bottom+frmBorder*2]+[1 0 1 0];
topFrmHndl=uicontrol( ...
'Style','frame', ...
'Units','pixel', ...
'Position',frmPos, ...
'BackgroundColor',[ 0.502 0.502 1 ]);
%------------------------------------
% The FIS NAME text window
labelStr='FIS Name:';
pos=[left top-btnHt btnWid btnHt];
hndl=uicontrol( ...
'Style','text', ...
'BackgroundColor',[ .7216 .7216 .9961 ], ...
'HorizontalAlignment','left', ...
'Units','pixel', ...
'Position',pos, ...
'FontWeight','bold',...
'FontSize',10,...
'String',labelStr);
%------------------------------------
% The FIS NAME edit window
name='fisname';
pos=[left+spacing+btnWid top-btnHt btnWid+20 btnHt];
hndl=uicontrol( ...
'Units','pixel', ...
'Style','text', ...
'HorizontalAlignment','left', ...
'Position',pos, ...
'FontWeight','normal',...
'FontSize',10,...
'BackgroundColor',[ .7216 .7216 .9961 ], ...
'Tag',name);
%------------------------------------
% The FIS TYPE text window
labelStr='FIS Type:';
pos=[right-spacing-2.1*btnWid top-btnHt btnWid btnHt];
hndl=uicontrol( ...
'Units','pixel', ...
'Style','text', ...
'BackgroundColor',[ .7216 .7216 .9961 ], ...
'HorizontalAlignment','left', ...
'Position',pos, ...
'Units','pixel', ...
'FontWeight','bold',...
'FontSize',10,...
'String',labelStr);
%------------------------------------
% The FIS TYPE text display
labelStr=' mamdani';
name='fistype';
pos=[right-1.1*btnWid top-btnHt btnWid+15 btnHt];
hndl=uicontrol( ...
'Units','pixel', ...
'Style','text', ...
'HorizontalAlignment','left', ...
'BackgroundColor',[ .7216 .7216 .9961 ], ...
'Position',pos, ...
'Tag',name, ...
'FontWeight','normal',...
'FontSize',8,...
'String',labelStr);
%====================================
% The METHODS frame
top=border+7*btnHt+7*spacing;
bottom=top-3*btnHt;
right=maxRight-border-spacing;
left=border+spacing;
frmBorder=spacing;
frmPos=[left-frmBorder bottom-frmBorder+8 ...
right-left+frmBorder*2 top-bottom+frmBorder-7]+[1 0 1 0];
mthFrmHndl=uicontrol( ...
'Style','frame', ...
'Units','pixel', ...
'Position',frmPos, ...
'BackgroundColor',[ 0.502 0.502 1 ]);
mthSpacing=(top-bottom-5*btnHt)/4+2;
% The AND METHOD text field
n=1;
labelStr='And method';
pos=[left top-btnHt*n-mthSpacing*(n-1)-5 btnWid-40 btnHt-5];
hndl=uicontrol( ...
'Style','text', ...
'BackgroundColor',[ 0.502 0.502 1 ], ...
'HorizontalAlignment','center', ...
'Units','pixel', ...
'Position',pos, ...
'String',labelStr);
%------------------------------------
% The AND METHOD popup menu
labelStr=str2mat(' min',' prod',' Custom...');
name='andMethod';
callbackStr='fuzzy2 #methodchange';
pos=[left+.7*btnWid top-btnHt*n-mthSpacing*(n-1)-5 btnWid-12 btnHt-5];
hndl=uicontrol( ...
'Style','popupmenu', ...
'BackgroundColor',[1 1 1], ...
'HorizontalAlignment','left', ...
'Units','pixel', ...
'Position',pos, ...
'Callback',callbackStr, ...
'Tag',name, ...
'String',labelStr);
%------------------------------------
% The OR METHOD text field
%n=2;
labelStr='Or method';
pos=[left+1.7*btnWid top-btnHt*n-mthSpacing*(n-1)-5 btnWid-40 btnHt-5];
hndl=uicontrol( ...
'Style','text', ...
'BackgroundColor',[ 0.502 0.502 1 ], ...
'HorizontalAlignment','center', ...
'Units','pixel', ...
'Position',pos, ...
'String',labelStr);
%------------------------------------
% The OR METHOD popup menu
labelStr=str2mat(' max',' Custom...');
name='orMethod';
callbackStr='fuzzy2 #methodchange';
pos=[left+2.4*btnWid top-btnHt*n-mthSpacing*(n-1)-5 btnWid-12 btnHt-5];
hndl=uicontrol( ...
'Style','popupmenu', ...
'HorizontalAlignment','left', ...
'BackgroundColor',[1 1 1], ...
'Units','pixel', ...
'Position',pos, ...
'Callback',callbackStr, ...
'Tag',name, ...
'String',labelStr);
%------------------------------------
% The IMPLICATION METHOD text field
%n=3;
labelStr='Implication';
pos=[left+3.4*btnWid top-btnHt*n-mthSpacing*(n-1)-5 btnWid-40 btnHt-5];
hndl=uicontrol( ...
'Style','text', ...
'BackgroundColor',[ 0.502 0.502 1 ], ...
'HorizontalAlignment','center', ...
'Units','pixel', ...
'Position',pos, ...
'String',labelStr);
%------------------------------------
% The IMPLICATION METHOD popup menu
labelStr=str2mat(' min',' prod',' Custom...');
name='impMethod';
callbackStr='fuzzy2 #methodchange';
pos=[left+4.1*btnWid top-btnHt*n-mthSpacing*(n-1)-5 btnWid-20 btnHt-5];
hndl=uicontrol( ...
'Style','popupmenu', ...
'HorizontalAlignment','left', ...
'BackgroundColor',[1 1 1], ...
'Units','pixel', ...
'Position',pos, ...
'Callback',callbackStr, ...
'Tag',name, ...
'String',labelStr);
if strcmp(fisType,'sugeno'),
set(hndl,'Enable','off');
end
%------------------------------------
% The AGGREGATION METHOD text field
n=3.3;
labelStr='Aggregation';
pos=[left top-btnHt*n-mthSpacing*(n-1)-5 btnWid-40 btnHt-5];
hndl=uicontrol( ...
'Style','text', ...
'BackgroundColor',[ 0.502 0.502 1 ], ...
'HorizontalAlignment','center', ...
'Units','pixel', ...
'Position',pos, ...
'String',labelStr);
%------------------------------------
% The AGGREGATION METHOD popup menu
labelStr=str2mat(' max',' sum',' Custom...');
name='aggMethod';
callbackStr='fuzzy2 #methodchange';
pos=[left+.7*btnWid top-btnHt*n-mthSpacing*(n-1)-5 btnWid-12 btnHt-5];
hndl=uicontrol( ...
'Style','popupmenu', ...
'HorizontalAlignment','left', ...
'Units','pixel', ...
'Position',pos, ...
'BackgroundColor',[1 1 1], ...
'Callback',callbackStr, ...
'Tag',name, ...
'String',labelStr);
if strcmp(fisType,'sugeno'),
set(hndl,'Enable','off');
end
%------------------------------------
% The REDUCTION METHOD text field
%n=5;
labelStr='Type-Reduction';
pos=[left+1.7*btnWid top-btnHt*n-mthSpacing*(n-1)-5 btnWid-35 btnHt-5];
hndl=uicontrol( ...
'Style','text', ...
'BackgroundColor',[ 0.502 0.502 1 ], ...
'HorizontalAlignment','center', ...
'Units','pixel', ...
'Position',pos, ...
'String',labelStr);
%------------------------------------
% The REDUCTION METHOD popup menu
if strcmp(fisType,'mamdani')| strcmp(fisType,'t2 non-singleton mamdani')| strcmp(fisType,'t1 non-singleton mamdani'),
% Reduction methods are different depending on the FIS type
labelStr=str2mat(' center_of_sets',' centroid',' height',' modified_height',' center_of_sums',...
' Custom...');
%elseif strcmp(fisType,'sugeno')
% labelStr=str2mat(' wtaver',' wtsum');
end
name='reducMethod';
callbackStr='fuzzy2 #methodchange';
pos=[left+2.4*btnWid top-btnHt*n-mthSpacing*(n-1)-5 btnWid-12 btnHt-5];
hndl=uicontrol( ...
'Style','popupmenu', ...
'HorizontalAlignment','left', ...
'Units','pixel', ...
'Position',pos, ...
'BackgroundColor',[1 1 1], ...
'Callback',callbackStr, ...
'Tag',name, ...
'String',labelStr);
if strcmp(fisType,'sugeno'),
set(hndl,'Enable','off');
end
%------------------------------------
% The DEFUZZIFICATION METHOD text field
%n=6;
labelStr='Defuzzification';
pos=[left+3.4*btnWid top-btnHt*n-mthSpacing*(n-1)-5 btnWid-40 btnHt-5];
hndl=uicontrol( ...
'Style','text', ...
'BackgroundColor',[ 0.502 0.502 1 ], ...
'HorizontalAlignment','center', ...
'Units','pixel', ...
'Position',pos, ...
'String',labelStr);
%------------------------------------
% The DEFUZZIFICATION METHOD popup menu
if strcmp(fisType,'mamdani')| strcmp(fisType,'t2 non-singleton mamdani')| strcmp(fisType,'t1 non-singleton mamdani'),
% Defuzzification methods are different depending on the FIS type
labelStr=str2mat(' centroid', ...
' Custom...');
elseif strcmp(fisType,'sugeno')
labelStr=str2mat(' wtaver',' wtsum');
end
name='defuzzMethod';
callbackStr='fuzzy2 #methodchange';
pos=[left+4.1*btnWid top-btnHt*n-mthSpacing*(n-1)-5 btnWid-20 btnHt-5];
hndl=uicontrol( ...
'Style','popupmenu', ...
'HorizontalAlignment','left', ...
'Units','pixel', ...
'Position',pos, ...
'BackgroundColor',[1 1 1], ...
'Callback',callbackStr, ...
'Tag',name, ...
'String',labelStr);
%====================================
% The STATUS frame
bottom=border+spacing-4;
top=bottom+btnHt;
right=maxRight-border-spacing;
left=border+spacing;
frmBorder=spacing;
frmPos=[left-frmBorder bottom-frmBorder ...
right-left+frmBorder*2 top-2.5*bottom+frmBorder*2]+[1 0 1 0];
topFrmHndl=uicontrol( ...
'Style','frame', ...
'Units','pixel', ...
'Position',frmPos, ...
'BackgroundColor',[ 0.502 0.502 1 ]);
%------------------------------------
% The STATUS text window
labelStr=' ';
name='status';
pos=[left bottom right-left btnHt-7];
statHndl=uicontrol( ...
'Style','text', ...
'BackgroundColor',[ 0.502 0.502 1 ], ...
'HorizontalAlignment','left', ...
'Units','pixel', ...
'Position',pos, ...
'Tag',name, ...
'String',labelStr);
%------------------------------------
% The HELP button
%labelStr='Help';
%callbackStr='fuzzy #help';
%helpHndl=uicontrol( ...
% 'Style','push', ...
% 'Position',[left+135 bottom+25 btnWid btnHt], ...
% 'BackgroundColor',[1 1 1], ...
% 'String',labelStr, ...
% 'Callback',callbackStr);
%------------------------------------
% The CLOSE button
labelStr='Close';
callbackStr='fisgui2 #close';
closeHndl=uicontrol( ...
'Style','push', ...
'Position',[right-325 bottom+25 btnWid btnHt], ...
'BackgroundColor',[1 1 1], ...
'String',labelStr, ...
'Callback',callbackStr);
%====================================
% The VARIABLES frame
top=border+6*btnHt+8*spacing;
bottom=border+7*spacing+2*btnHt;
right=maxRight-border-spacing;
left=(maxRight)/2+2*spacing;
frmBorder=spacing;
frmPos=[left-150 bottom-30 ...
right-left+frmBorder*2 top-bottom-27]+[1 0 1 0];
varFrmHndl=uicontrol( ...
'Units','pixel', ...
'Style','frame', ...
'Position',frmPos, ...
'BackgroundColor',[ 0.502 0.502 1 ]);
varSpacing=(top-bottom-4*btnHt)/3;
%------------------------------------
% The CURRENT VARIABLE text field
n=3.2;
labelStr='Current Variable';
pos=[left-145 top-btnHt*n-varSpacing*(n-1) right-left btnHt-5];
uicontrol( ...
'Units','pixel', ...
'Style','text', ...
'BackgroundColor',[ 0.502 0.502 1 ], ...
'HorizontalAlignment','left', ...
'Position',pos, ...
'String',labelStr);
%------------------------------------
% The CURRENT VARIABLE NAME text field
n=3.9;
labelStr='Name';
pos=[left-145 top-btnHt*n-varSpacing*(n-1) right-left btnHt-5];
hndl=uicontrol( ...
'Units','pixel', ...
'Style','text', ...
'BackgroundColor',[ 0.502 0.502 1 ], ...
'HorizontalAlignment','left', ...
'Position',pos, ...
'String',labelStr);
%------------------------------------
% The CURRENT VARIABLE NAME edit field
callbackStr='fuzzy2 #varname';
name='currvarname';
pos=[left-25 top-btnHt*n-varSpacing*(n-1) btnWid btnHt-5];
inputVarNameHndl=uicontrol( ...
'Units','pixel', ...
'Style','edit', ...
'HorizontalAlignment','left', ...
'Position',pos, ...
'Enable','off', ...
'BackgroundColor',[1 1 1], ...
'Tag',name, ...
'Callback',callbackStr);
%------------------------------------
% The CURRENT VARIABLE TYPE text field
n=4.6;
labelStr='Type';
pos=[left-145 top-btnHt*n-varSpacing*(n-1) btnWid btnHt-5];
uicontrol( ...
'Units','pixel', ...
'Style','text', ...
'HorizontalAlignment','left', ...
'Position',pos, ...
'BackgroundColor',[ 0.502 0.502 1 ], ...
'String',labelStr);
%------------------------------------
% The CURRENT VARIABLE TYPE text field
name='currvartype';
pos=[left-25 top-btnHt*n-varSpacing*(n-1) btnWid btnHt-5];
hndl=uicontrol( ...
'Style','text', ...
'HorizontalAlignment','left', ...
'BackgroundColor',[ 0.502 0.502 1 ], ...
'Units','pixel', ...
'Position',pos, ...
'Tag',name);
%------------------------------------
% The CURRENT VARIABLE RANGE text field
n=5.1;
labelStr='Range';
pos=[left-145 top-btnHt*n-varSpacing*(n-1) btnWid btnHt-7];
outputVarNameHndl=uicontrol( ...
'Style','text', ...
'HorizontalAlignment','left', ...
'Units','pixel',...
'Position',pos, ...
'BackgroundColor',[ 0.502 0.502 1 ], ...
'String',labelStr);
%------------------------------------
% The CURRENT VARIABLE RANGE display field
name='currvarrange';
pos=[left-25 top-btnHt*n-varSpacing*(n-1) btnWid btnHt-5];
outputVarNameHndl=uicontrol( ...
'Style','text', ...
'HorizontalAlignment','left', ...
'Units','pixel',...
'Position',pos, ...
'BackgroundColor',[ 0.502 0.502 1 ], ...
'Tag',name);
fuzzy2 #update
% Uncover the figure
set(figNumber, ...
'Visible','on', ...
'HandleVisibility','callback');
elseif strcmp(action,'#update'),
%====================================
figNumber=watchon;
oldfis=get(figNumber,'UserData');
fis=oldfis{1};
if isfield(fis, 'input')
NumInputs=length(fis.input);
else
NumInputs=0;
end
if isfield(fis, 'output')
NumOutputs=length(fis.output);
else
NumOutputs=0;
end
if isfield(fis, 'rule')
NumRules=length(fis.rule);
else
NumRules=0;
end
% The FIS NAME edit window
name='fisname';
hndl=findobj(figNumber,'Type','uicontrol','Tag',name);
fisName=fis.name;
labelStr=[' ' fisName];
set(hndl,'String',labelStr);
% The FIS TYPE text field
name='fistype';
hndl=findobj(figNumber,'Type','uicontrol','Tag',name);
fisType=fis.type;
set(hndl,'String',fisType);
% Clear all current variable display registers ...
varTypeHndl=findobj(figNumber,'Type','uicontrol','Tag','currvartype');
set(varTypeHndl,'String',' ');
varNameHndl=findobj(figNumber,'Type','uicontrol','Tag','currvarname');
set(varNameHndl,'String',' ','Enable','off');
varRangeHndl=findobj(figNumber,'Type','uicontrol','Tag','currvarrange');
set(varRangeHndl,'String',' ');
% The AND METHOD popup menu
name='andMethod';
hndl=findobj(figNumber,'Type','uicontrol','Tag',name);
labelStr=get(hndl,'String');
andMethod=fis.andMethod;
val=findrow2(andMethod,labelStr);
if isempty(val),
labelStr=str2mat([' ' andMethod],labelStr);
msgStr=['Installing custom And method "' andMethod '"'];
statmsg2(figNumber,msgStr);
set(hndl,'String',labelStr,'Value',1);
elseif val~=get(hndl,'Value'),
set(hndl,'Value',val);
end
% The OR METHOD popup menu
name='orMethod';
hndl=findobj(figNumber,'Type','uicontrol','Tag',name);
labelStr=get(hndl,'String');
orMethod=fis.orMethod;
val=findrow2(orMethod,labelStr);
if isempty(val),
labelStr=str2mat([' ' orMethod],labelStr);
msgStr=['Installing custom Or method "' orMethod '"'];
statmsg2(figNumber,msgStr);
set(hndl,'String',labelStr,'Value',1);
elseif val~=get(hndl,'Value'),
set(hndl,'Value',val);
end
if ~strcmp(fisType,'sugeno'),
% The IMPLICATION METHOD popup menu
name='impMethod';
hndl=findobj(figNumber,'Type','uicontrol','Tag',name);
labelStr=get(hndl,'String');
impMethod=fis.impMethod;
val=findrow2(impMethod,labelStr);
if isempty(val),
labelStr=str2mat([' ' impMethod],labelStr);
msgStr=['Installing custom Implication method "' impMethod '"'];
statmsg2(figNumber,msgStr);
set(hndl,'String',labelStr,'Value',1);
elseif val~=get(hndl,'Value'),
set(hndl,'Value',val);
end
% The AGGREGATION METHOD popup menu
name='aggMethod';
hndl=findobj(figNumber,'Type','uicontrol','Tag',name);
labelStr=get(hndl,'String');
aggMethod=fis.aggMethod;
val=findrow2(aggMethod,labelStr);
if isempty(val),
labelStr=str2mat([' ' aggMethod],labelStr);
msgStr=['Installing custom Aggregation method "' aggMethod '"'];
statmsg2(figNumber,msgStr);
set(hndl,'String',labelStr,'Value',1);
elseif val~=get(hndl,'Value'),
set(hndl,'Value',val);
end
end
% The REDUCTION METHOD popup menu
name='reducMethod';
hndl=findobj(figNumber,'Type','uicontrol','Tag',name);
labelStr=get(hndl,'String');
reducMethod=fis.reducMethod;
val=findrow2(reducMethod,labelStr);
if isempty(val),
labelStr=str2mat([' ' reducMethod],labelStr);
msgStr=['Installing custom Reduction method "' reducMethod '"'];
statmsg2(figNumber,msgStr);
set(hndl,'String',labelStr,'Value',1);
elseif val~=get(hndl,'Value'),
set(hndl,'Value',val);
end
% The DEFUZZIFICATION METHOD popup menu
name='defuzzMethod';
hndl=findobj(figNumber,'Type','uicontrol','Tag',name);
labelStr=get(hndl,'String');
defuzzMethod=fis.defuzzMethod;
val=findrow2(defuzzMethod,labelStr);
if isempty(val),
labelStr=str2mat([' ' defuzzMethod],labelStr);
msgStr=['Installing custom Defuzzification method "' defuzzMethod '"'];
statmsg2(figNumber,msgStr);
set(hndl,'String',labelStr,'Value',1);
elseif val~=get(hndl,'Value'),
set(hndl,'Value',val);
end
% Now plot the FIS diagram
% First delete all axes except for the main one
axHndlList=findobj(figNumber,'Type','axes');
mainAxHndl=findobj(figNumber,'Type','axes','Tag','mainaxes');
axHndlList(find(axHndlList==mainAxHndl))=[];
delete(axHndlList);
lineHndlList=findobj(figNumber,'Type','line');
delete(lineHndlList);
fuzzy2 #plotfis
fisName=fis.name;
msgStr=[ 'System "' fisName '": ' num2str(NumInputs) ' inputs, ' ...
num2str(NumOutputs) ' outputs, and ' ...
num2str(NumRules) ' rules'];
if NumInputs==1, msgStr=strrep(msgStr,'inputs','input'); end
if NumOutputs==1, msgStr=strrep(msgStr,'outputs','output'); end
if NumRules==1, msgStr=strrep(msgStr,'rules','rule'); end
statmsg2(figNumber,msgStr);
watchoff(figNumber)
elseif strcmp(action,'#keypress'),
%====================================
figNumber=gcf;
if abs(get(figNumber,'CurrentCharacter'))==127,
if ~isempty(findobj(figNumber,'Type','axes','XColor',selectColor)),
fuzzy2 #rmvar
end
end
elseif strcmp(action,'#rmvar'),
%====================================
figNumber=watchon;
oldfis=get(figNumber,'UserData');
fis=oldfis{1};
currVarAxes=findobj(figNumber,'Type','axes','XColor',selectColor);
if isempty(currVarAxes),
statmsg2(figNumber,'No variable was selected!');
watchoff(figNumber)
return
end
varIndex=get(currVarAxes,'UserData');
tag=get(currVarAxes,'Tag');
if strcmp(tag(1:5),'input'),
varType='input';
else
varType='output';
end
% Find the corresponding name display field
varNameHndl=findobj(figNumber,'Type','uicontrol','Tag','currvarname');
if strcmp(varType, 'input'),
varName=fis.input(varIndex).name;
elseif strcmp(varType, 'output'),
varName=fis.output(varIndex).name;
end
if strcmp(varType,'input'),
numVars=length(fis.input);
%%% varLabels=fis.InLabels;
else
numVars=length(fis.output);
%%% varLabels=fis.OutLabels;
end
% Remove a variable
[fis,errorMsg]=rmvar2(fis,varType,varIndex);
if isempty(fis),
% rmvar has failed for one reason or other
statmsg2(figNumber,errorMsg)
else
msgStr=['Removing the ' varType ' variable "' varName '"'];
statmsg2(figNumber,msgStr);
pushundo2(figNumber,fis);
updtfis2(figNumber,fis,[2 3 4 5 6]);
% Now replot the FIS diagram
% First delete all axes except for the main one
axHndlList=findobj(figNumber,'Type','axes');
mainAxHndl=findobj(figNumber,'Type','axes','Tag','mainaxes');
axHndlList(find(axHndlList==mainAxHndl))=[];
delete(axHndlList);
lineHndlList=findobj(figNumber,'Type','line');
delete(lineHndlList);
fuzzy2 #plotfis
% Clear the VARIABLE NAME, TYPE, and RANGE fields
hndl=findobj(figNumber,'Type','uicontrol','Tag','currvarname');
set(hndl,'String',' ');
hndl=findobj(figNumber,'Type','uicontrol','Tag','currvartype');
set(hndl,'String',' ');
hndl=findobj(figNumber,'Type','uicontrol','Tag','currvarrange');
set(hndl,'String',' ');
end
watchoff(figNumber)
elseif strcmp(action,'#addvar'),
%====================================
figNumber=watchon;
currMenu=gcbo;
varType=get(currMenu,'Tag');
oldfis=get(figNumber,'UserData');
fis=oldfis{1};
% "Add" has been selected, so add a variable
if strcmp(varType,'input'),
numVars=length(fis.input);
else
numVars=length(fis.output);
end
numVars=numVars+1;
newVarName=[varType num2str(numVars)];
msgStr=['Adding the ' varType ' variable "' newVarName '"'];
statmsg2(figNumber,msgStr);
fis=addvar2(fis,varType,newVarName,[0 1]);
pushundo2(figNumber,fis);
updtfis2(figNumber,fis,[2 3 4 5 6]);
% set(figNumber,'UserData',fis);
% Now replot the FIS diagram
% First delete all axes except for the main one
axHndlList=findobj(figNumber,'Type','axes');
mainAxHndl=findobj(figNumber,'Type','axes','Tag','mainaxes');
axHndlList(find(axHndlList==mainAxHndl))=[];
delete(axHndlList);
lineHndlList=findobj(figNumber,'Type','line');
delete(lineHndlList);
fuzzy2 #plotfis
% Clear the VARIABLE NAME, TYPE, and RANGE fields
hndl=findobj(figNumber,'Type','uicontrol','Tag','currvarname');
set(hndl,'String',' ');
hndl=findobj(figNumber,'Type','uicontrol','Tag','currvartype');
set(hndl,'String',' ');
hndl=findobj(figNumber,'Type','uicontrol','Tag','currvarrange');
set(hndl,'String',' ');
statmsg2(figNumber,'Ready');
watchoff(figNumber)
elseif strcmp(action,'#deselect'),
%====================================
figNumber=watchon;
% Deselect all variables
oldCurrVar=findobj(figNumber,'Type','axes','XColor',selectColor);
set(oldCurrVar, ...
'LineWidth',1, ...
'XColor','black','YColor','black');
% Clear all current variable display registers ...
varTypeHndl=findobj(figNumber,'Type','uicontrol','Tag','currvartype');
set(varTypeHndl,'String',' ');
varNameHndl=findobj(figNumber,'Type','uicontrol','Tag','currvarname');
set(varNameHndl,'String',' ','Enable','off');
varRangeHndl=findobj(figNumber,'Type','uicontrol','Tag','currvarrange');
set(varRangeHndl,'String',' ');
rmvarMenuHndl=findobj(figNumber,'Type','uimenu','Tag','removevar');
set(rmvarMenuHndl,'Enable','off')
watchoff(figNumber)
elseif strcmp(action,'#selectvar'),
%====================================
figNumber=watchon;
oldfis=get(figNumber,'UserData');
fis=oldfis{1};
% newCurrVarPatch=get(figNumber,'CurrentObject');
newCurrVarPatch = gcbo;
newCurrVar=get(newCurrVarPatch,'Parent');
varIndex=get(newCurrVar,'UserData');
tag=get(newCurrVar,'Tag');
if strcmp(tag(1:5),'input'),
varType='input';
else
varType='output';
end
% Deselect all others if necessary
oldCurrVar=findobj(figNumber,'Type','axes','XColor',selectColor);
if newCurrVar~=oldCurrVar,
set(oldCurrVar,'XColor','k','YColor','k');
set(oldCurrVar,'LineWidth',1);
end
% Now hilight the new selection
set(newCurrVar,'XColor',selectColor,'YColor',selectColor);
set(newCurrVar,'LineWidth',3);
% Set all current variable display registers ...
varNameHndl=findobj(figNumber,'Type','uicontrol','Tag','currvarname');
varRangeHndl=findobj(figNumber,'Type','uicontrol','Tag','currvarrange');
if strcmp(varType, 'input'),
set(varNameHndl,'String',[' ' fis.input(varIndex).name],'Enable','on');
set(varRangeHndl,'String',mat2str(fis.input(varIndex).range));
else
set(varNameHndl,'String',[' ' fis.output(varIndex).name],'Enable','on');
set(varRangeHndl,'String',mat2str(fis.output(varIndex).range));
end
varTypeHndl=findobj(figNumber,'Type','uicontrol','Tag','currvartype');
set(varTypeHndl,'String',varType);
rmvarMenuHndl=findobj(figNumber,'Type','uimenu','Tag','removevar');
set(rmvarMenuHndl,'Enable','on')
if strcmp(get(figNumber,'SelectionType'),'open'),
% Open the MF Editor with the right variable in view
fisName=fis.name;
guiName='Membership Function Editor';
newFigNumber=findobj(0,'Name',[guiName ': ' fisName]);
if ~isempty(newFigNumber),
statmsg2(figNumber,['Updating ' guiName]);
figure(newFigNumber);
mfedit2('#update',varType,varIndex);
else
statmsg2(figNumber,['Opening ' guiName]);
mfedit2(fis,varType,varIndex);
end
end
watchoff(figNumber)
elseif strcmp(action,'#varname'),
%====================================
figNumber=watchon;
oldfis=get(figNumber,'UserData');
fis=oldfis{1};
currVarAxes=findobj(figNumber,'Type','axes','XColor',selectColor);
varIndex=get(currVarAxes,'UserData');
tag=get(currVarAxes,'Tag');
if strcmp(tag(1:5),'input'),
varType='input';
else
varType='output';
end
varNameHndl=findobj(figNumber,'Type','uicontrol','Tag','currvarname');
newName=deblank(get(varNameHndl,'String'));
% Strip off the leading space
newName=fliplr(deblank(fliplr(newName)));
% Replace any remaining blanks with underscores
newName(find(newName==32))=setstr(95*ones(size(find(newName==32))));
set(varNameHndl,'String',[' ' newName]);
msgStr=['Renaming ' varType ' variable ' num2str(varIndex) ' to "' newName '"'];
statmsg2(figNumber,msgStr);
% Change the name of the label in the input-output diagram
txtHndl=get(currVarAxes,'XLabel');
set(txtHndl,'String',newName);
eval(['fis.' varType '(' num2str(varIndex) ').name=''' newName ''';']);
pushundo2(figNumber,fis); %%strcmp does not work for structures
updtfis2(figNumber,fis,[2 3 4 5]);
watchoff(figNumber);
elseif strcmp(action,'#methodchange'),
%====================================
figNumber=watchon;
mthHndl=gco;
oldfis=get(figNumber,'UserData');
fis=oldfis{1};
mthList=get(mthHndl,'String');
numMth=size(mthList,1);
% The UserData for the popup will tell which method is being
% changed, e.g. andmethod, ormethod, impmethod, etc.
mthName=get(mthHndl,'Tag');
newMthValue=get(mthHndl,'Value');
newMth=deblank(mthList(newMthValue,:));
newMth=fliplr(deblank(fliplr(newMth)));
tempStr=['fis.' mthName];
oldMth=eval(tempStr);
oldMthValue=findrow2(oldMth,mthList);
if strcmp(newMth,'Custom...'),
% Handle customized methods...
mthName2=strrep(mthName,'method',' method');
tString=['Adding customized ' mthName2];
statmsg2(figNumber,tString);
cmthdlg2(figNumber,fis,mthName);
% In case there's a Cancel, return to the old value
set(mthHndl,'Value',oldMthValue);
elseif newMthValue~=oldMthValue,
% Only change things if the method has actually changed
mthName2=strrep(mthName,'method',' method');
tString=['Changing ' mthName2 ' to "' newMth '"'];
statmsg2(figNumber,tString);
eval(['fis.' mthName '=''' newMth ''';']);
% Handle undo
pushundo2(figNumber,fis)
updtfis2(figNumber,fis,[4 5]);
% set(figNumber,'UserData',fis);
end
% statmsg(figNumber,'Ready');
watchoff(figNumber);
elseif strcmp(action,'#openruleedit'),
%====================================
figNumber=watchon;
oldfis=get(figNumber,'UserData');
fis=oldfis{1};
if strcmp(get(figNumber,'SelectionType'),'open'),
% Open the Rule Editor
fisName=fis.name;
guiName='Rule Editor';
newFigNumber=findobj(0,'Name',[guiName ': ' fisName]);
if ~isempty(newFigNumber),
statmsg2(figNumber,['Updating ' guiName]);
figure(newFigNumber);
ruleedit2('#update');
else
statmsg2(figNumber,['Opening ' guiName]);
ruleedit2(fis);
end
end
watchoff(figNumber)
elseif strcmp(action,'#plotfis'),
%====================================
figNumber=gcf;
oldfis=get(figNumber,'UserData');
fis=oldfis{1};
set(figNumber,'Nextplot','replace')
if isfield(fis, 'input')
numInputs=length(fis.input);
else
numInputs=0;
end
if isfield(fis, 'output')
numOutputs=length(fis.output);
else
numOutputs=0;
end
numInputMFs=0;
for k=1:numInputs,
numInputMFs=numInputMFs+length(fis.input(k));
end;
numOutputMFs=0;
for k=1:numOutputs,
numOutputMFs=numOutputMFs+length(fis.output(k));
end;
numRules=length(fis.rule);
ruleList=getfis2(fis, 'ruleList');
fisName=fis.name;
fisType=fis.type;
mainAxHndl=gca;
set(mainAxHndl,'Units','pixel','Visible','off')
mainAxPos=get(mainAxHndl,'Position');
axis([mainAxPos(1) mainAxPos(1)+mainAxPos(3) ...
mainAxPos(2) mainAxPos(2)+mainAxPos(4)]);
xCenter=mainAxPos(1)+mainAxPos(3)/2;
yCenter=mainAxPos(2)+mainAxPos(4)/2;
axList=[];
if get(0,'ScreenDepth')>2,
inputColor=[1 0.8235 1];
outputColor=[0.7686 1 0.7686];
else
inputColor=[1 1 1];
outputColor=[1 1 1];
set(gcf,'Color',[1 1 1])
end
% For plotting three cartoon membership functions in the box
xMin=-1; xMax=1;
%x=(-1:0.1:1)';
%y1=exp(-(x+1).^2/0.32); y2=exp(-x.^2/0.32); y3=exp(-(x-1).^2/0.32);
%xlineMatrix=[x x x];
%ylineMatrix=[y1 y2 y3];
%birinci için
xaxis=(-1:0.05:1)';
principal=exp(-(xaxis).^2/0.32) ;
upper=min(1,1.1*principal) ;
lower=0.8*principal;
lower1=0.83*principal;upper1=min(1,1.05*principal) ;
lower2=0.86*principal;lower3=0.89*principal;lower4=0.92*principal;lower5=0.95*principal;
xlineMatrix=[xaxis xaxis];
ylineMatrix=[upper lower];
xlineMatrix1=[xaxis xaxis xaxis xaxis xaxis xaxis];
ylineMatrix1=[lower1 lower2 lower3 lower4 lower5 upper1];
%ikinci için
principala=exp(-(xaxis+1).^2/0.32) ;
uppera=min(1,1.1*principala) ;
lowera=0.8*principala;
lower1a=0.83*principala;upper1a=min(1,1.05*principala) ;
lower2a=0.86*principala;lower3a=0.89*principala;lower4a=0.92*principala;lower5a=0.95*principala;
xlineMatrixa=[xaxis xaxis];
ylineMatrixa=[uppera lowera];
xlineMatrix1a=[xaxis xaxis xaxis xaxis xaxis xaxis];
ylineMatrix1a=[lower1a lower2a lower3a lower4a lower5a upper1a];
%üçüncü için
principalb=exp(-(xaxis-1).^2/0.32) ;
upperb=min(1,1.1*principalb) ;
lowerb=0.8*principalb;
lower1b=0.83*principalb;upper1b=min(1,1.05*principalb) ;
lower2b=0.86*principalb;lower3b=0.89*principalb;lower4b=0.92*principalb;lower5b=0.95*principalb;
xlineMatrixb=[xaxis xaxis];
ylineMatrixb=[upperb lowerb];
xlineMatrix1b=[xaxis xaxis xaxis xaxis xaxis xaxis];
ylineMatrix1b=[lower1b lower2b lower3b lower4b lower5b upper1b];
% Inputs first
fontSize=8;
boxWid=(1/3)*mainAxPos(3);
xInset=boxWid/5;
if numInputs>0,
boxHt=(1/(numInputs))*mainAxPos(4);
yInset=boxHt/5;
end
for varIndex=1:numInputs,
boxLft=mainAxPos(1);
boxBtm=mainAxPos(2)+mainAxPos(4)-boxHt*varIndex;
axPos=[boxLft+xInset boxBtm+yInset boxWid-2*xInset boxHt-2*yInset];
% Draw the line that connects the input to the main block
axes(mainAxHndl);
% Make it a dotted line if the variable is not used in the rule base
if numRules==0,
lineStyle='--';
elseif ~any((ruleList(:,varIndex))),
lineStyle='--';
else
lineStyle='-';
end
xInputCenter=axPos(1)+axPos(3);
yInputCenter=axPos(2)+axPos(4)/2;
line([xInputCenter xCenter],[yInputCenter yCenter], ...
'LineStyle',lineStyle, ...
'LineWidth',2, ...
'Color',[ 0.502 0.502 1 ]);
% Now draw the little arrowhead on the line
% perpSlope=(xInputCenter-xCenter)/(yCenter-yInputCenter);
% arrowPt=[(xCenter+xInputCenter)/2 (yCenter+yInputCenter)/2];
% delta=(xCenter-xInputCenter)/10;
% line([xArrowPt xArrowPt
varName=fis.input(varIndex).name;
axName=['input' num2str(varIndex)];
axHndl=axes( ...
'Units','pixel', ...
'Box','on', ...
'XTick',[],'YTick',[], ...
'XLim',[xMin xMax],'YLim',[-0.1 1.1], ...
'Color',inputColor, ...
'Tag',axName, ...
'UserData',varIndex, ...
'Position',axPos);
axList=[axList axHndl];
line(xlineMatrix,ylineMatrix,'Color','black');
line(xlineMatrix1,ylineMatrix1,'LineStyle',':','Color','black');
line(xlineMatrixa,ylineMatrixa,'Color','black');
line(xlineMatrix1a,ylineMatrix1a,'LineStyle',':','Color','black');
line(xlineMatrixb,ylineMatrixb,'Color','black');
line(xlineMatrix1b,ylineMatrix1b,'LineStyle',':','Color','black');
xiInset=(xMax-xMin)/10;
axis([xMin-xiInset xMax+xiInset -0.1 1.1])
% Lay down a patch that simplifies clicking on the region
patchHndl=patch([xMin xMax xMax xMin],[0 0 1 1],'black');
set(patchHndl, ...
'EdgeColor','none', ...
'FaceColor','none', ...
'ButtonDownFcn','fuzzy2 #selectvar');
% Now put on the variable name as a label
% xlabel([varName ' (' num2str(numInputMFs(varIndex)) ')']);
xlabel(varName);
labelName=[axName 'label'];
set(get(axHndl,'XLabel'), ...
'FontSize',fontSize, ...
'Color','black', ...
'Tag',labelName, ...
'ButtonDownFcn','fuzzy2 #selectvar');
end
% Now for the outputs
if numOutputs>0,
boxHt=(1/(numOutputs))*mainAxPos(4);
yInset=boxHt/5;
end
for varIndex=1:numOutputs,
boxLft=mainAxPos(1)+2*boxWid;
boxBtm=mainAxPos(2)+mainAxPos(4)-boxHt*varIndex;
axPos=[boxLft+xInset boxBtm+yInset boxWid-2*xInset boxHt-2*yInset];
% Draw the line connect the center block to the output
axes(mainAxHndl);
% Make it a dotted line if the variable is not used in the rule base
if numRules==0,
lineStyle='--';
elseif ~any(ruleList(:,varIndex+numInputs)),
lineStyle='--';
else
lineStyle='-';
end
line([axPos(1) xCenter],[axPos(2)+axPos(4)/2 yCenter], ...
'LineWidth',2, ...
'LineStyle',lineStyle, ...
'Color',[ 0.502 0.502 1 ]);
varName=fis.output(varIndex).name;
axName=['output' num2str(varIndex)];
axHndl=axes( ...
'Units','pixel', ...
'Box','on', ...
'Color',outputColor, ...
'XTick',[],'YTick',[], ...
'Tag',axName, ...
'UserData',varIndex, ...
'Position',axPos);
axList=[axList axHndl];
if ~strcmp(fisType,'sugeno'),
% Don't try to plot outputs it if it's a Sugeno-style system
%ortadaki
x=[0.28 0 -0.45 -0.75 -0.25 0.25 0.5]';
xlineMatrix=[x];
ylineMatrix=[0.27 0.7 0 0 1 1 0.6]';
line(xlineMatrix,ylineMatrix,'Color','black');
x=[0.28 0 -0.55 -0.65 -0.2 0.2 0.4]';
xlineMatrix=[x];
ylineMatrix=[0.37 0.8 0 0 0.95 0.95 0.6]';
line(xlineMatrix,ylineMatrix,'LineStyle',':','Color','black');
x=[-0.55 -0.15 0.15 0.35]';
xlineMatrix=[x];
ylineMatrix=[0 0.9 0.9 0.4]';
line(xlineMatrix,ylineMatrix,'LineStyle',':','Color','black');
x=[0.28 0 -0.25]';
xlineMatrix=[x];
ylineMatrix=[0.47 0.9 0.6]';
line(xlineMatrix,ylineMatrix,'LineStyle',':','Color','black');
%saðdaki
x=[1 0.75 0.1 0.45 1]';
xlineMatrix=[x];
ylineMatrix=[1 1 0 0 0.7]';
line(xlineMatrix,ylineMatrix,'Color','black');
x=[1 0.85 0.2 0.35 1]';
xlineMatrix=[x];
ylineMatrix=[0.95 0.95 0 0 0.8]';
line(xlineMatrix,ylineMatrix,'LineStyle',':','Color','black');
x=[1 0.95 0.3]';
xlineMatrix=[x];
ylineMatrix=[0.9 0.9 0]';
line(xlineMatrix,ylineMatrix,'LineStyle',':','Color','black');
%soldaki
x=[-1 -0.75 -0.45]';
xlineMatrix=[x];
ylineMatrix=[1 1 0.6]';
line(xlineMatrix,ylineMatrix,'Color','black');
x=[-1 -0.8 -0.55]';
xlineMatrix=[x];
ylineMatrix=[0.95 0.95 0.55]';
line(xlineMatrix,ylineMatrix,'LineStyle',':','Color','black');
x=[-1 -0.85 -0.65]';
xlineMatrix=[x];
ylineMatrix=[0.9 0.9 0.45]';
line(xlineMatrix,ylineMatrix,'LineStyle',':','Color','black');
x=[-1 -0.62]';
xlineMatrix=[x];
ylineMatrix=[0.7 0.25]';
line(xlineMatrix,ylineMatrix,'Color','black');
x=[-1 -0.62]';
xlineMatrix=[x];
ylineMatrix=[0.8 0.35]';
line(xlineMatrix,ylineMatrix,'LineStyle',':','Color','black');
%sol alt bacak
x=[-0.4 -0.35 -0.01 -0.25]';
xlineMatrix=[x];
ylineMatrix=[0.09 0 0 0.32]';
line(xlineMatrix,ylineMatrix,'Color','black');
x=[-0.11 -0.35]';
xlineMatrix=[x];
ylineMatrix=[0 0.25]';
line(xlineMatrix,ylineMatrix,'LineStyle',':','Color','black');
x=[-0.16 -0.45]';
xlineMatrix=[x];
ylineMatrix=[0 0.2]';
line(xlineMatrix,ylineMatrix,'LineStyle',':','Color','black');
%sað alt bacak
x=[0.48 0.5 0.9 0.7]';
xlineMatrix=[x];
ylineMatrix=[0.04 0 0 0.32]';
line(xlineMatrix,ylineMatrix,'Color','black');
x=[0.58 0.6 0.8 0.6]';
xlineMatrix=[x];
ylineMatrix=[0.04 0 0 0.32]';
line(xlineMatrix,ylineMatrix,'LineStyle',':','Color','black');
x=[0.7 0.5]';
xlineMatrix=[x];
ylineMatrix=[0 0.32]';
line(xlineMatrix,ylineMatrix,'LineStyle',':','Color','black');
xoInset=(xMax-xMin)/10;
axis([xMin-xoInset xMax+xoInset -0.1 1.1])
else
set(axHndl,'XLim',[xMin xMax],'YLim',[-0.1 1.1])
text(0,0.5,'f(u)', ...
'FontSize',fontSize, ...
'Color','black', ...
'HorizontalAlignment','center');
end
% Lay down a patch that simplifies clicking on the region
patchHndl=patch([xMin xMax xMax xMin],[0 0 1 1],'black');
set(patchHndl, ...
'EdgeColor','none', ...
'FaceColor','none', ...
'ButtonDownFcn','fuzzy2 #selectvar');
% xlabel([varName ' (' num2str(numOutputMFs(varIndex)) ')']);
xlabel(varName);
labelName=[axName 'label'];
set(get(axHndl,'XLabel'), ...
'FontSize',fontSize, ...
'Color','black', ...
'Tag',labelName, ...
'ButtonDownFcn','fuzzy2 #selectvar');
end
% Now draw the box in the middle
boxLft=mainAxPos(1)+boxWid;
boxBtm=mainAxPos(2);
boxHt=mainAxPos(4);
yInset=boxHt/4;
axPos=[boxLft+xInset boxBtm+yInset boxWid-2*xInset+15 boxHt-2*yInset+5];
axHndl=axes( ...
'Units','pixel', ...
'Box','on', ...
'XTick',[],'YTick',[], ...
'YLim',[-1 1],'XLim',[-1 1], ...
'XColor',[0 0 0.6275],'YColor',[0 0 0.6275], ...
'LineWidth',3, ...
'ButtonDownFcn','fuzzy2 #openruleedit', ...
'Color','white', ...
'Position',axPos);
axList=[axList axHndl];
text(0,1/3,fisName, ...
'Tag','fisname', ...
'FontSize',fontSize, ...
'ButtonDownFcn','', ...
'Color','black', ...
'HorizontalAlignment','center');
text(0,-1/3,['(' fisType ')'], ...
'FontSize',7, ...
'ButtonDownFcn','fuzzy2 #openruleedit', ...
'Color','black', ...
'HorizontalAlignment','center');
% text(0,-1/2,[num2str(numRules) ' rules'], ...
% 'ButtonDownFcn','fuzzy2 #openruleedit', ...
% 'FontSize',fontSize, ...
% 'Color','black', ...
% 'HorizontalAlignment','center');
set(get(axHndl,'Title'),'FontSize',fontSize,'Color','black');
for count=1:length(axList),
axes(axList(count));
end
set(figNumber,'HandleVisibility','callback')
hndlList=findobj(figNumber,'Units','pixels');
set(hndlList,'Units','normalized')
%elseif strcmp(action,'#help');
%====================================
%figNumber=watchon;
%helpwin('fuzzy/fuzzy/fuzzy');
%watchoff(figNumber)
end; % if strcmp(action, ...

Answers (1)

Fangjun Jiang
Fangjun Jiang on 4 Jun 2020
replace "while findobj(0,'Type','figure','Name',figName)" with
"while isempty(findobj(0,'Type','figure','Name',figName))"

Categories

Find more on Axes Appearance in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!