Main Content

addBlockParamArg

Class: RTW.TflBlockEntry
Namespace: RTW

Add block property data type information

Since R2024a

Syntax

addBlockParamArg(blockEntry,arg)

Description

addBlockParamArg(blockEntry,arg) specifies the block property and data type information, represented by arg, that the block replacement entry blockEntry must match. You must add data type information for the block properties that you use for derived arguments or implementation arguments in the block entry.

Input Arguments

expand all

Block entry object, specified as an RTW.TflBlockEntry object.

Block property data type representation, specified as an argument handle. Create an argument handle that specifies the property and data type by using the getTflArgFromString function or the RTW.TflArgMatrix or RTW.TflArgNumeric class. When you create the argument handle, specify the block property name as the argument name.

Example: RTW.TflArgMatrix('Coefficient','RTW_IO_INPUT','int16')

Examples

expand all

Create an entry for the Discrete FIR filter in which the implementation function uses the length of the block property Coefficients.

Create a block replacement entry object and specify the key for the Discrete FIR filter block.

entry = RTW.TflBlockEntry;
entry.Key = 'DiscreteFir';

Create an argument that represents the block property and the data type that the implementation requires. For this example, specify that the Coefficients property must be set to a value that is a matrix of type int16.

arg = RTW.TflArgMatrix('Coefficients','RTW_IO_INPUT','int16');

During code replacement, the entry will match blocks in which the value of the Coefficients property is a matrix of type int16.

Specify the dimension range of the Coefficients matrix.

arg.DimRange = [1 1; Inf Inf];

Add the property information to the block entry.

addBlockParamArg(entry,arg);

To check the property information in the entry, use the BlockParamArgs property.

entry.BlockParamArgs
ans = 

  TflArgMatrix with properties:

         BaseTypeIsUnsizedInt: 0
        BaseTypeIsUnsizedLong: 0
    BaseTypeIsUnsizedLongLong: 0
                     DimRange: [2×2 double]
                   CheckSlope: 1
                    CheckBias: 1
                    CheckType: 1
                     MetaData: []
                         Name: 'Coefficient'
                         Type: [1×1 coder.descriptor.types.Matrix]
                       IOType: 'RTW_IO_INPUT'
                   Descriptor: []

Version History

Introduced in R2024a