Main Content

tostring

Convert fi, fimath, numerictype, or quantizer object to string

Description

example

s = tostring(a) converts fi object a to a character vector s such that eval(s) would create a fi object with the same properties as a.

example

s = tostring(F) converts fimath object F to a character vector s such that eval(s) would create a fimath object with the same properties as F.

example

s = tostring(T) converts numerictype object T to a character vector s such that eval(s) would create a numerictype object with the same properties as T.

example

s = tostring(q) converts quantizer object q to a character vector s such that eval(s) would create a quantizer object with the same properties as q.

Examples

collapse all

a = fi(pi,1,16,10);
s = tostring(a)
a1 = eval(s)
isequal(a,a1)
s =

    'fi('numerictype',numerictype(1,16,10),'Value','3.1416015625')'


a1 = 

    3.1416

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 16
        FractionLength: 10

ans =

  logical

   1
F = fimath('OverflowAction','Saturate','RoundingMethod','Convergent');
s = tostring(F)
F1 = eval(s)
isequal(F,F1)
s =

    'fimath('RoundingMethod', 'Convergent',...
     'OverflowAction', 'Saturate',...
     'ProductMode','FullPrecision',...
     'SumMode','FullPrecision')'


F1 = 


        RoundingMethod: Convergent
        OverflowAction: Saturate
           ProductMode: FullPrecision
               SumMode: FullPrecision

ans =

  logical

   1
T = numerictype(1,16,15);
s = tostring(T)
T1 = eval(s)
isequal(T,T1)
s =

    'numerictype(1,16,15)'


T1 =


          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 16
        FractionLength: 15

ans =

  logical

   1
q = quantizer('fixed','Ceiling','Saturate',[5 4]);
s = tostring(q)
q1 = eval(s)
isequal(q,q1)
s =

    'quantizer('fixed', 'ceil', 'saturate', [5  4])'


q1 =


        DataMode = fixed
       RoundMode = ceil
    OverflowMode = saturate
          Format = [5  4]

ans =

  logical

   1

Input Arguments

collapse all

Input fi object.

Data Types: fi
Complex Number Support: Yes

Input fimath object.

Input numerictype object.

Input quantizer object.

Version History

Introduced before R2006a