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

    function P = addprop(P,Name,varargin)
%ADDPROP add property to property collection
%
% P = addprop(P,Name,fGet,fSet,Type,Options,Description)

%  Copyright 2006-2007 The MathWorks, Inc.

S = P.ObjectProperties;
if isfield(S,Name)
    % remove property if it exists so property appears at end of list
    S = rmfield(S,Name);
end

% make propertyinterface object and store it in ObjectProperties structure
S.(Name) = mbcfoundation.propertyinterface(Name,varargin{:});

P.ObjectProperties = S;