coder.FiType class

Package: coder
Superclasses: coder.ArrayType

Represent set of MATLAB fixed-point arrays

Description

Specifies the set of fixed-point array values that the generated code should accept. Use only with the fiaccel -args options. Do not pass as an input to the generated MEX function.

Construction

t=coder.typeof(v) creates a coder.FiType object representing a set of fixed-point values whose properties are based on the fixed-point input v.

t=coder.typeof(v, sz, variable_dims) returns a modified copy of coder.typeof(v) with (upper bound) size specified by sz and variable dimensions variable_dims. If sz specifies inf for a dimension, then the size of the dimension is unbounded and the dimension is variable size. When sz is [], the (upper bound) sizes of v do not change. If you do not specify the variable_dims input parameter, the bounded dimensions of the type are fixed. When variable_dims is a scalar, it applies to the bounded dimensions that are not 1 or 0 (which are fixed).

t=coder.newtype('embedded.fi', numerictype, sz, variable_dims) creates a coder.Type object representing a set of fixed-point values with numerictype and (upper bound) sizes sz and variable dimensions variable_dims. If sz specifies inf for a dimension, then the size of the dimension is unbounded and the dimension is variable size. When you do not specify variable_dims, the bounded dimensions of the type are fixed. When variable_dims is a scalar, it applies to the bounded dimensions that are not 1 or 0 (which are fixed).

t=coder.newtype('embedded.fi', numerictype, sz, variable_dims, Name, Value) creates a coder.Type object representing a set of fixed-point values with numerictype and additional options specified by one or more Name, Value pair arguments. Name can also be a property name and Value is the corresponding value. Name must appear inside single quotes (''). You can specify several name-value pair arguments in any order as Name1,Value1,…,NameN,ValueN.

Input Arguments

v

Fixed-point value used to create new coder.FiType object.

sz

Size vector specifying each dimension of type object.

Default: [1 1] for coder.newtype

variable_dims

Logical vector that specifies whether each dimension is variable size (true) or fixed size (false).

Default: false(size(sz)) | sz ==Inf for coder.newtype

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

'complex'

Set complex to true to create a coder.Type object that can represent complex values. The type must support complex data.

Default: false

'fimath'

Specify local fimath. If not, uses default fimath.

Properties

ClassName

Class of values in the set.

Complex

Indicates whether fixed-point arrays in the set are real (false) or complex (true).

Fimath

Local fimath that the fixed-point arrays in the set use.

NumericType

numerictype that the fixed-point arrays in the set use.

SizeVector

The upper-bound size of arrays in the set.

VariableDims

A vector specifying whether each dimension of the array is fixed or variable size. If a vector element is true, the corresponding dimension is variable size.

Copy Semantics

Value. To learn how value classes affect copy operations, see Copying Objects in the MATLAB® documentation.

Examples

Create a new fixed-point type t.

t = coder.typeof(fi(1));
% Returns
% coder.FiType
%   1x1 embedded.fi
%       DataTypeMode:Fixed-point: binary point scaling
%         Signedness:Signed
%         WordLength:16
%     FractionLength:14

Create a new fixed-point type for use in code generation. The fixed-point type uses the default fimath.

t = coder.newtype('embedded.fi',numerictype(1, 16, 15), [1 2])

t = 
% Returns
% coder.FiType
%   1x2 embedded.fi 
%          DataTypeMode: Fixed-point: binary point scaling
%          Signedness: Signed
%          WordLength: 16
%          FractionLength: 15

This new type uses the default fimath.

Was this topic helpful?