Skip to Main Content Skip to Search
Product Documentation

createAndSetCImplementationReturn - Create implementation return argument from specified properties and add to implementation for CRL table entry

Syntax

arg = createAndSetCImplementationReturn(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.

varargin

Parameter/value pairs for the implementation return argument. See varargin Parameters.

varargin Parameters

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

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

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

IOType

String specifying the I/O type of the argument: 'RTW_IO_OUTPUT' for output.

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.

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 for a fixed-point argument, for example, 15.0. The default is 1.

You can optionally specify either this parameter or a combination of the SlopeAdjustmentFactor and FixedExponent parameters, but do not specify both.

SlopeAdjustmentFactor

Floating-point value specifying the slope adjustment factor (F) part of the slope, F2E, of the argument. The default is 1.0.

You can optionally specify either the Slope parameter or a combination of this parameter and the FixedExponent parameter, but do not specify both.

FixedExponent

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

You can optionally specify either the Slope parameter or a combination of this parameter and the SlopeAdjustmentFactor parameter, but do not specify both.

Bias

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

FractionLength

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

Output Arguments

Handle to the created implementation return argument. Specifying the return argument in the createAndSetCImplementationReturn function call is optional.

Description

The createAndSetCImplementationReturn function creates an implementation return argument from specified properties and adds the argument to the implementation for a CRL table.

Examples

In the following example, the createAndSetCImplementationReturn function is used along with the createAndAddImplementationArg function to specify the output and input arguments for an operator implementation.

op_entry = RTW.TflCOperationEntry;
.
.
.
createAndSetCImplementationReturn(op_entry, 'RTW.TflArgNumeric', ...
                                  'Name',       'y1', ...
                                  'IOType',     'RTW_IO_OUTPUT', ...
                                  'IsSigned',   true, ...
                                  'WordLength', 32, ...
                                  'FractionLength', 0);
                                  
createAndAddImplementationArg(op_entry, 'RTW.TflArgNumeric',...
                              'Name',       'u1', ...
                              'IOType',     'RTW_IO_INPUT',...
                              'IsSigned',   true,...
                              'WordLength', 32, ...
                              'FractionLength', 0 );
                               
createAndAddImplementationArg(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 createAndSetCImplementationReturn.

% uint8:
createAndSetCImplementationReturn(hEntry, 'RTW.TflArgNumeric', ...
                              'Name',           'y1', ... 
                              'IOType',         'RTW_IO_OUTPUT', ...
                              'IsSigned',       false, ...
                              'WordLength',     8, ...
                              'FractionLength', 0 );

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

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

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

See Also

createAndAddImplementationArg

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