pushundo.m

来自「最新模糊逻辑工具箱」· M 代码 · 共 35 行

M
35
字号
function pushundo(figNumber,newFis)
%PUSHUNDO Push the current FIS onto the undo stack.
%   PUSHUNDO(figNumber,newFIS) pushes the old FIS matrix into the UserData
%   for the Undo uimenu. The function also broadcasts changes in the FIS
%   matrix to all the other related GUI tools, since it gets called every
%   time the FIS matrix gets updated.

%   Kelly Liu 5-6-1996 addopt from Ned Gulley
%   Copyright (c) 1994-98 by The MathWorks, Inc.
%   $Revision: 1.9 $  $Date: 1997/12/01 21:45:16 $

undoLimit=3;

undoHndl=findobj(figNumber,'Type','uimenu','Tag','undo');
oldFis=get(figNumber,'UserData');
% If a change has been made, then store the old FIS matrix
% in the undo cubbyhole for later use. In other words, newFis is passed
% in just to make a comparison and potentially save time.
if ~isequal(oldFis(1), newFis), %%% no matter what

    % Push the new FIS structure onto the stack
    if length(oldFis)<undoLimit
     endindex=length(oldFis)+1;
    else
     endindex=undoLimit;
    end
    for i=endindex:-1:2
      Fis{i}=oldFis{i-1};
    end
    Fis{1}=newFis;
    set(figNumber, 'UserData', Fis);
    set(undoHndl, 'Enable','on');
end

⌨️ 快捷键说明

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