Skip to Main Content Skip to Search
Product Documentation

createAndAddConceptualArg - Create conceptual argument from specified properties and add to conceptual arguments for CRL table entry

Syntax

arg = createAndAddConceptualArg(hEntry, argType, varargin)

Input Arguments

hEntry

Handle to a CRL table entry previously returned by instantiating a CRL entry class, such as hEntry = RTW.TflCFunctionEntry or hEntry = RTW.TflCOperationEntry.

argType

String specifying the argument type to create: 'RTW.TflArgNumeric' for numeric or 'RTW.TflArgMatrix' for matrix.

varargin

Parameter/value pairs for the conceptual argument. See varargin Parameters.

varargin Parameters

The following argument properties can be specified to the createAndAddConceptualArg function using parameter/value argument pairs. For example,

createAndAddConceptualArg(..., 'DataTypeMode', 'double', ...);
Name

String specifying the argument name, for example, 'y1' or 'u1'.

IOType

String specifying the I/O type of the argument: 'RTW_IO_INPUT' for input or 'RTW_IO_OUTPUT' for output. The default is 'RTW_IO_INPUT'.

IsSigned

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

WordLength

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

CheckSlope

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

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.

CheckBias

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

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.

DataTypeMode

String specifying the data type mode of the argument: 'boolean', 'double', 'single', 'Fixed-point: binary point scaling', or 'Fixed-point: slope and bias scaling'. The default is 'Fixed-point: binary point scaling'.

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

DataType

String specifying the data type of the argument: 'boolean', 'double', 'single', or 'Fixed'. The default is 'Fixed'.

Scaling

String specifying the data type scaling of the argument: 'BinaryPoint' for binary-point scaling or 'SlopeBias' for slope and bias scaling. The default is 'BinaryPoint'.

Slope

Floating-point value specifying the slope of the argument, for example, 15.0. The default is 1.

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

SlopeAdjustmentFactor

Floating-point value specifying the slope adjustment factor (F) part of the slope, F2E, of the argument. The default is 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.

FixedExponent

Integer value specifying the fixed exponent (E) part of the slope, F2E, of the argument. The default is -15.

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.

Bias

Floating-point value specifying the bias of the argument, for example, 2.0. The default is 0.0.

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

FractionLength

Integer value specifying the fraction length for the argument, for example, 3. The default is 15.

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

BaseType

String specifying the base data type for which a matrix argument is valid, for example, 'double'.

DimRange

Dimensions for which a matrix argument is valid, for example, [2 2]. 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 any two-dimensional matrix of size 2x2 or larger.

Output Arguments

Handle to the created conceptual argument. Specifying the return argument in the createAndAddConceptualArg function call is optional.

Description

The createAndAddConceptualArg function creates a conceptual argument from specified properties and adds the argument to the conceptual arguments for a CRL table entry.

Examples

In the following example, thecreateAndAddConceptualArg function is used to specify conceptual output and input arguments for a CRL operator entry.

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 );

The following examples show some common type specifications using createAndAddConceptualArg.

% 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);

For examples of fixed-point arguments that use relative scaling or relative slope/bias values, see Create Fixed-Point Operator Entries for Relative Scaling (Multiplication and Division) and Create Fixed-Point Operator Entries for Equal Slope and Zero Net Bias (Addition and Subtraction) in the Embedded Coder documentation.

How To

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS