www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgprecfloat/set.m

    function Prec = set(Prec, PropertyName, PropertyValue)
%SET Set properties of a cgprecfloat object.
%
%   FLOATPREC = SET(FLOATPREC, PropertyName, PropertyValue) modifies the
%   property PropertyName of a cgprecfloat object FLOATPREC to a value
%   PropertyValue.
%
%   See also CGPRECFLOAT.

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


if nargin~=3
    error(message('mbc:cgprecfloat:InvalidArgument1'));
end

% Try to use extra input as a property name if valid
switch lower(PropertyName)
    case 'mbits',
        % Set mbits
        Prec.mbits = PropertyValue;
    case 'ebits',
        % Set ebits
        Prec.ebits = PropertyValue;
    case 'physrange',
        % Set PhysRange
        Prec.PhysRange = PropertyValue;
    otherwise
        % No valid property name at this level, try the superclass
        Prec.cgprec = ...
            set(Prec.cgprec, PropertyName, PropertyValue);
end