Main Content

RTW.TflArgMatrix Class

Namespace: RTW

Matrix argument for code replacement entry

Description

Use the RTW.TflArgMatrix class to finely control the specification of a matrix argument for a code replacement entry.

Creation

Description

RTW.TflArgMatrix(name,IOType) creates a matrix argument, specifies the name, and specifies whether the argument is an input or an output.

example

Input Arguments

expand all

Argument name, specified as a character vector or string scalar.

Input or output argument, specified as either 'RTW_IO_INPUT' or 'RTW_IO_OUTPUT'.

Properties

expand all

Name of the argument, specified as a character vector or string scalar.

Example: 'u1'

Input or output argument, specified as either 'RTW_IO_INPUT' or 'RTW_IO_OUTPUT'.

Whether to match the slope value of the base type of the argument for a fixed-point operator, specified as true (1) or false (0).

Whether to match the bias value of the base type of the argument for a fixed-point operator, specified as true (1) or false (0).

Range of matrix dimensions, specified as a 2-by-N matrix, where N is the number of dimensions of the matrix argument. Specify the dimension range in the format [Dim1Min Dim2Min ... DimNMin; Dim1Max Dim2Max ... DimNMax]. The first row specifies the minimum value for each dimension and the second row specifies the maximum value for each dimension. For example, [2 2; Inf Inf] means a two-dimensional matrix of size 2-by-2 or larger.

Example: [2 2; Inf Inf]

Examples

collapse all

In this example, you create a code replacement entry for a function that takes a matrix as an input argument. When you create a code replacement library, include this code in the function that defines the code replacement table.

Create an entry object and set the parameters for the entry.

% Create an entry
hEntry = RTW.TflCOperationEntry;

% Create entry parameters
hEntry.setTflCOperationEntryParameters(...
     'Key',                      'RTW_OP_ADD', ...
     'Priority',                 30, ...
     'SaturationMode',           'RTW_WRAP_ON_OVERFLOW', ...
     'ImplementationName',       'matrix_sum_4x4_double');

Create the conceptual representation of the input argument by creating an RTW.TflArgMatrix object. Use the object to specify properties of the matrix argument. For example, set the dimension range to [4 4; Inf Inf]. The argument must be a two-dimensional matrix of size 4-by-4 or larger.

arg = RTW.TflArgMatrix('u1', 'RTW_IO_INPUT',  'single');
arg.DimRange = [4 4; Inf Inf];

Add the conceptual argument to the entry.

hEntry.addConceptualArg(arg);

After you create the entry, add the entry to the code replacement table.

Version History

Introduced in R2007b