www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgtools/@cgbrowser/reset.m

    function reset(h)
%RESET Reset the Cage browser handle's data
%
%  RESET(H) resets the browser's properties to their default values.  Note
%  that you should use this with caution as it will destroy a current
%  session

%  Copyright 2000-2015 The MathWorks, Inc. and Ford Global Technologies, Inc.


% First disable all listeners;
L = h.Listeners;
ListNames = fieldnames(L);
for n = 1:length(ListNames)
    L.(ListNames{n}).enabled = 'off';
end

% Reset all properties apart from listeners to their default values
c = classhandle(h);
p = c.Properties;

for n = 1:length(p)
    if ~strcmp(p(n).Name, 'Listeners')
        h.(p(n).Name) = p(n).FactoryValue;
    end
end

% Re-enable all listeners
for n = 1:length(ListNames)
    L.(ListNames{n}).enabled = 'on';
end

mbcutils.GenericTableProvider.Instance.resetTableProvider();