www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgsurfview/@dataviewer/setPlotOptions.m

    function setPlotOptions(obj,in)
%SETPLOTOPTIONS Sets the current plot options to previously saved values
%
% obj.setPlotOptions(s)
%
% s should be a structure previously returned by getPlotOptions

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


names = { obj.plottypes.shortname };

for i=1:numel(names)
    if isfield(in,names{i})
        optobj = obj.plottypes(i).optionsobj;
        if isempty(optobj)
            disp(sprintf('Can''t set options for plot type "%s"',names{i}));
            continue;
        end
        s = in.(names{i});
        f = fieldnames(s);
        for k=1:numel(f)
            try
                optobj.(f{k}) = s.(f{k});
            catch ME
                disp(sprintf('Bad plot options for plot type "%s": %s',names{i},ME.message));
            end
        end
    end
end