www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/@mbcfoundation/@actionlist/addSingleton.m

    function addSingleton(h, cmd, date)
%ADDSINGLETON Add a single version of a command to the action list
%
%   ADDSINGLETON(H, CMD) adds the callback command CMD to the end of the
%   list of actions if it is not already in the list.
%
%   ADDSINGLETON(H, CMD, DATE) specifies the date that is used to order
%   actions during playback.  The DATENUM function is used to convert the
%   date input into a serial date number for ordering. 

%   Copyright 2005 The MathWorks, Inc.


if nargin==2
    A = mbcfoundation.action(cmd);
else
    A = mbcfoundation.action(cmd, date);
end
if ~any(isIdenticalAction(A, h.Actions))
    h.Actions = [h.Actions; A];
    h.Actions(end).connect(h, 'up');
end