⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editsets.m

📁 为了下载东西
💻 M
📖 第 1 页 / 共 2 页
字号:
function editsets(strSetFile)
%
%  Please see editsets.m function body.
%
%  Petur Snaeland, 10.04.1995
%  Revised Hordur Kvaran 20.10.97


%##############################################################################
%
%  DECLARE GLOBAL HANDLES AND VARIABLES THAT WILL BE USED WHILE EDITING SETS
%
global Universe PosSets VelSets OutSets CurrentUniverse CurrentSet CurrentBrkPt gstrSetFile;


%##############################################################################
%
%  LOAD THE .MAT FILE CONTAINING THE FUZZY SET DESCRIPTIONS
%
load(strSetFile);                            % Load the file that was passed in.
gstrSetFile = strSetFile;                    % Keep the filename in a global variable.
PosSets = [ ISL ; ISM ; ISR ];               % Collect position sets in a 3*5 matrix.
VelSets = [ MVL ; SST ; MVR ];               % Collect velocity sets in a 3*5 matrix.
OutSets = [ PHL ; PSL ; OOO ; PSR ; PHR ];   % Collect output sets in a 5*1 matrix.
CurrentUniverse = PosSets;                   % Initialize to Position Universe ...
Universe = 1;                                % ...the first item in the listbox.
CurrentSet = 1;                              % Initialize to the 1st position set.
CurrentBrkPt = 1;                            % Initialize to the 1st breakpoint.


%##############################################################################
%
%  DEFINE POSITION VECTORS OF THE EDITING WINDOW AND ITS CONTROLS
%
MainPos = get(gcf,'Position');               %  The position of the main program window:
MainX = MainPos(1); MainY = MainPos(2); MainW = MainPos(3); MainH = MainPos(4);
gap = 10; BtnW = 75; BtnH = 20; BoxW = 485; BoxH = 3*gap+BtnH + 200;
posWindow   = [MainX+(MainW-BoxW)/2 MainY+(MainH-BoxH)/2 BoxW BoxH];
posUniv     = [gap gap BtnW BtnH];
posSets     = [2*gap+BtnW gap 0.75*BtnW BtnH];
posBrkPts   = [3*gap+1.75*BtnW gap 2*BtnW BtnH];
posBrkPt    = [4*gap+3.75*BtnW gap 0.50*BtnW BtnH];
posLinTyp   = [BoxW-100-gap gap 100 20];
posOK       = [BoxW-100-gap BoxH-25-gap 100 25];
posCancel   = [BoxW-100-gap BoxH-2*25-1.5*gap 100 25];
posDefault  = [BoxW-100-gap BoxH/2 100 25];
posMouse    = posDefault + [0 -25-0.5*gap 0 0];
posMirror   = posMouse + [0 -25-0.5*gap 0 0];


%##############################################################################
%
%  DEFINE STRINGS FOR THE LISTBOXES
%
if strSetFile == 'cartsets',
   strUniv = ' Position | Velocity | Output';
else
   strUniv = ' Angle | Velocity | Output';
end;
strSets     = ' ISL | ISM | ISR';
strBrkPts   = ' Leftmost breakpoint | Left shoulder point | Right shoulder point | Rightmost breakpoint';
strLinTyp   = ' Cosine | Linear';


%##############################################################################
%
%  DEFINE CALLBACK STRINGS FOR THE CONTROLS
%  These strings specify how to respond when the user clicks the respective control.
%
cmdOK       = ['global Universe CurrentUniverse gstrSetFile PosSets VelSets OutSets;', ...
               'if Universe==1, ', ...
               '   PosSets = CurrentUniverse; ', ...
               'elseif Universe==2, ', ...
               '   VelSets = CurrentUniverse; ', ...
               'elseif Universe==3, ', ...
               '   OutSets = CurrentUniverse; ', ...
               'end; ', ...
               'ISL = PosSets(1,:) ; ISM = PosSets(2,:) ; ISR = PosSets(3,:);', ...
               'MVL = VelSets(1,:) ; SST = VelSets(2,:) ; MVR = VelSets(3,:);', ...
               'PHL = OutSets(1,:) ; PSL = OutSets(2,:) ; OOO = OutSets(3,:);', ...
               'PSR = OutSets(4,:) ; PHR = OutSets(5,:) ; ', ...
               'save ' gstrSetFile ' ISL ISM ISR MVL SST MVR PHL PSL OOO PSR PHR; ', ...
               'if (gstrSetFile==''cartsets''),doevent(''CartTable'');',...
               'else doevent(''BallTable''); end;',...
               'clear ISL ISM ISR MVL SST MVR PHL PSL OOO PSR PHR; ', ...
               'clear global Universe CurrentUniverse CurrentSet CurrentBrkPt ', ...
               '      PosSets VelSets OutSets gstrSetFile;', ...
               'close(gcf); '];


cmdCancel   = ['clear global Universe CurrentUniverse CurrentSet CurrentBrkPt ', ...
               '      PosSets VelSets OutSets gstrSetFile;', ...
               'close(gcf);'];


cmdDefault  = ['global Universe CurrentUniverse CurrentSet CurrentBrkPt; ', ...
               'htxtBrkPt = findobj(''Tag'',''txtSetsBrkPt''); ',...
               'hlstLinTyp = findobj(''Tag'',''lstSetsLinTyp''); ',...
               'if Universe==1, ', ...
               '   CurrentUniverse = [ -100  -100  -100     0     1 ;  ', ...
               '                       -100     0     0   100     1 ;  ', ...
               '                          0   100   100   100     1 ]; ', ...
               '   set(htxtBrkPt,''String'',num2str(CurrentUniverse(CurrentSet,CurrentBrkPt))); ', ...
               'elseif Universe==2, ', ...
               '   CurrentUniverse = [ -100  -100  -100     0     1 ;  ', ...
               '                       -100     0     0   100     1 ;  ', ...
               '                          0   100   100   100     1 ]; ', ...
               '   set(htxtBrkPt,''String'',num2str(CurrentUniverse(CurrentSet,CurrentBrkPt))); ', ...
               'elseif Universe==3, ', ...
               '   CurrentUniverse = [ -200; -100;    0;  100;  200 ]; ', ...
               '   set(htxtBrkPt,''String'',num2str(CurrentUniverse(CurrentSet))); ', ...
               'end; set(hlstLinTyp,''Value'',2); plotsets(CurrentUniverse,CurrentSet);',...
               'clear hlstLinTyp htxtBrkPt; '];


cmdMouse    = ['global CurrentUniverse CurrentSet CurrentBrkPt Universe; ', ...
               'htxtBrkPt = findobj(''Tag'',''txtSetsBrkPt''); ',...
               '[Xmouse Ymouse] = ginput(1); eval(setstr(13)); ', ...
               'if Universe~=3, ', ...
               '   CurrentUniverse(CurrentSet,CurrentBrkPt) = round(Xmouse); ', ...
               '   CurrentUniverse(CurrentSet,1) = min(CurrentUniverse(CurrentSet,1),CurrentUniverse(CurrentSet,2));',...
               '   CurrentUniverse(CurrentSet,4) = max(CurrentUniverse(CurrentSet,3),CurrentUniverse(CurrentSet,4));',...               
               '   set(htxtBrkPt,''String'',CurrentUniverse(CurrentSet,CurrentBrkPt)); ', ...
               'else ', ...
               '   CurrentUniverse(CurrentSet) = round(Xmouse); ', ...
               '   set(htxtBrkPt,''String'',round(Xmouse)); ',...
               'end; ', ...
               'plotsets(CurrentUniverse,CurrentSet); clear htxtBrkPt Xmouse Ymouse; '];
               
cmdMirror   = ['global Universe CurrentUniverse CurrentSet CurrentBrkPt; ', ...
               'htxtBrkPt = findobj(''Tag'',''txtSetsBrkPt''); ',...
               'hlstLinTyp = findobj(''Tag'',''lstSetsLinTyp''); ',...
               'if Universe~=3, ', ...
               '   CurrentUniverse(2,3:4) = [ -fliplr(CurrentUniverse(2,1:2)) ];  ', ...
               '   CurrentUniverse(3,:)   = [ -fliplr(CurrentUniverse(1,1:4)) ,   ', ...
               '                              CurrentUniverse(1,5)            ];  ', ...
               '   set(htxtBrkPt,''String'',num2str(CurrentUniverse(CurrentSet,CurrentBrkPt))); ', ...
               'elseif Universe==3, ', ...
               '   CurrentUniverse(3:5)   = [ 0; -flipud(CurrentUniverse(1:2)) ]; ', ...
               '   set(htxtBrkPt,''String'',num2str(CurrentUniverse(CurrentSet))); ', ...

⌨️ 快捷键说明

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