Main Content

createAndAddConceptualArg

Create conceptual argument from specified properties and add to conceptual arguments for code replacement table entry

Description

example

arg = createAndAddConceptualArg(hEntry,argType, varargin) creates a conceptual argument from specified properties and adds the argument to the conceptual arguments for a code replacement table entry.

Examples

collapse all

This example shows how to use thecreateAndAddConceptualArg function to specify conceptual output and input arguments for a code replacement operator entry.

For examples of fixed-point arguments that use relative scaling or relative slope/bias values, see Net Slope Scaling Code Replacement and Equal Slope and Zero Net Bias Code Replacement.

op_entry = RTW.TflCOperationEntry;
.
.
.
createAndAddConceptualArg(op_entry, 'RTW.TflArgNumeric', ...
    'Name',       'y1', ...
    'IOType',     'RTW_IO_OUTPUT', ...
    'IsSigned',   true, ...
    'WordLength', 32, ...
    'FractionLength', 0);
                                  
createAndAddConceptualArg(op_entry, 'RTW.TflArgNumeric',...
    'Name',       'u1', ...
    'IOType',     'RTW_IO_INPUT',...
    'IsSigned',   true,...
    'WordLength', 32, ...
    'FractionLength', 0 );
                               
createAndAddConceptualArg(op_entry, 'RTW.TflArgNumeric',...
    'Name',       'u2', ...
    'IOType',     'RTW_IO_INPUT',...
    'IsSigned',   true,...
    'WordLength', 32, ...
    'FractionLength', 0 );

These examples show some common type specifications using createAndAddConceptualArg.

hEntry = RTW.TflCOperationEntry;
.
.
.
% uint8:
createAndAddConceptualArg(hEntry, 'RTW.TflArgNumeric', ...
    'Name',           'u1', ... 
    'IOType',         'RTW_IO_INPUT', ...
    'IsSigned',       false, ...
    'WordLength',     8, ...
    'FractionLength', 0 );

% single:
createAndAddConceptualArg(hEntry, 'RTW.TflArgNumeric', ...
    'Name',         'u1', ... 
    'IOType',       'RTW_IO_INPUT', ...
    'DataTypeMode', 'single' );

% double:
createAndAddConceptualArg(hEntry, 'RTW.TflArgNumeric', ...
    'Name',         'y1', ... 
    'IOType',       'RTW_IO_OUTPUT', ...
    'DataTypeMode', 'double' );

% boolean:
createAndAddConceptualArg(hEntry, 'RTW.TflArgNumeric', ...
    'Name',         'u1', ... 
    'IOType',       'RTW_IO_INPUT', ...
    'DataTypeMode', 'boolean' );

% Fixed-point using binary-point-only scaling:
createAndAddConceptualArg(hEntry, 'RTW.TflArgNumeric', ...
    'Name',           'y1', ... 
    'IOType',         'RTW_IO_OUTPUT', ...
    'CheckSlope',     true, ...
    'CheckBias',      true, ...
    'DataTypeMode',   'Fixed-point: binary point scaling', ...
    'IsSigned',       true, ...
    'WordLength',     32, ...
    'FractionLength', 28);

% Fixed-point using [slope bias] scaling:
createAndAddConceptualArg(hEntry, 'RTW.TflArgNumeric', ...
    'Name',           'y1', ... 
    'IOType',         'RTW_IO_OUTPUT', ...
    'CheckSlope',     true, ...
    'CheckBias',      true, ...
    'DataTypeMode',   'Fixed-point: slope and bias scaling', ...
    'IsSigned',       true, ...
    'WordLength',     16, ...
    'Slope',          15, ...
    'Bias',           2);

Input Arguments

collapse all

The hEntry is a handle to a code replacement table entry previously returned by instantiating a code replacement table entry class, such as hEntry = RTW.TflCFunctionEntry or hEntry = RTW.TflCOperationEntry.

Example: op_entry

The argType is a character vector or string scalar that specifies the argument type to create. Use 'RTW.TflArgNumeric' for numeric or 'RTW.TflArgMatrix' for matrix.

Example: 'RTW.TflArgNumeric'

Example: 'Name','y1'

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 quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'Name','y1'

Example: 'Name','y1'

Use value 'RTW_IO_INPUT' for input or value 'RTW_IO_OUTPUT'.

Example: 'IOType','RTW_IO_INPUT'

Boolean value that, when set to true, indicates that the argument is signed.

Example: 'IsSigned',true

Integer specifying the word length, in bits, of the argument. The default is 16.

Example: 'WordLength',16

Boolean flag that, when set to true for a fixed-point argument, causes code replacement request processing to check that the slope value of the argument exactly matches the call-site slope value.

Specify true if you are matching a specific [slope bias] scaling combination or a specific binary-point-only scaling combination on fixed-point operator inputs and output. Specify false if you are matching relative scaling or relative slope and bias values across fixed-point operator inputs and output.

Example: 'CheckSlope',true

Boolean flag that, when set to true for a fixed-point argument, causes code replacement request processing to check that the bias value of the argument exactly matches the call-site bias value.

Specify true if you are matching a specific [slope bias] scaling combination or a specific binary-point-only scaling combination on fixed-point operator inputs and output. Specify false if you are matching relative scaling or relative slope and bias values across fixed-point operator inputs and output.

Example: 'CheckBias',true

You can specify either DataType (with Scaling) or DataTypeMode, but do not specify both.

Example: 'DataTypeMode','Fixed-point: binary point scaling'

Example: 'DataType','Fixed'

Specify the data type scaling of the argument as 'BinaryPoint' for binary-point scaling or 'SlopeBias' for slope and bias scaling.

Example: 'Scaling','BinaryPoint'

If you are matching a specific [slope bias] scaling combination on fixed-point operator inputs and output, specify either this parameter or a combination of the SlopeAdjustmentFactor and FixedExponent parameters.

Example: 'Slope',1.0

If you are matching a specific [slope bias] scaling combination on fixed-point operator inputs and output, specify either the Slope parameter or a combination of this parameter and the FixedExponent parameter.

Example: 'SlopeAdjustmentFactor',1.0

If you are matching a specific [slope bias] scaling combination on fixed-point operator inputs and output, specify either the Slope parameter or a combination of this parameter and the SlopeAdjustmentFactor parameter.

Example: 'FixedExponent',-15

Specify this parameter if you are matching a specific [slope bias] scaling combination on fixed-point operator inputs and output.

Example: 'Bias',2.0

Specify this parameter if you are matching a specific binary-point-only scaling combination on fixed-point operator inputs and output.

Example: 'FractionLength',15

Example: 'BaseType','double'

You can also specify a range of dimensions specified in the format [Dim1Min Dim2Min ... DimNMin; Dim1Max Dim2Max ... DimNMax]. For example, [2 2; inf inf] means a two-dimensional matrix of size 2x2 or larger.

Example: 'DimRange',[2 2]

Output Arguments

collapse all

The arg is a handle to the created conceptual argument. Specifying the return argument in the createAndAddConceptualArg function call is optional.

Introduced in R2007b