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

    function str = char(Prec)
%CHAR Return a readable representation of a cgprecpolyfix object.
%
%   STR = CHAR(PREC) returns a string that represents the object.

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


nbits = get(Prec,'bits');
s = get(Prec,'signed');
if s
    str = 'Signed';
else
    str = 'Unsigned';
end
n = get(Prec,'NumCoeff');
d = get(Prec,'DenCoeff');
if length(n) == 2 && isequal(n, [1 0]) && isequal(d, [0 1])
    str = sprintf('%s %d bit fixed point', str, nbits);
else
    str = sprintf(['%s %d bit fixed point with a ratio of polynomials for ' ...
        'hardware to physical conversion'], str, nbits);
end