addAlgorithmProperty

Add algorithm properties for code replacement table entry

Syntax

addAlgorithmProperty(hEntry, name-value)

Arguments

hEntry

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

name-value

Algorithm property, specified as a comma-separated pair consisting of the name of an algorithm property and one or more algorithm values. Specify multiple values as a cell array of character vectors.

NameValues
'BPPower2Spacing''off'|'on'
'ExtrapMethod''Clip' | 'Linear'
'IndexSearchMethod''Evenly spaced points' | 'Linear search' | 'Binary search'
'InterpMethod' 'Linear point-slope' | 'Linear Lagrange'| 'Flat'|'Nearest'
'RemoveProtectionInput''off' | 'on'
'RndMeth''Ceiling' | 'Convergent' | 'Floor' | 'Nearest' | 'Round' | 'Simplest' | 'Zero'
'SaturateOnIntegerOverflow''off' | 'on'
'SupportTunableTableSize''off' | 'on'
'UseLastTableValue''off' | 'on'
'UseRowMajorAlgorithm''off' | 'on'

Description

The addAlgorithmProperty function adds algorithm property settings to the conceptual representation of a code replacement table entry. For example, use this function to adjust the algorithms applied by lookup table functions.

Examples

In the following example, the addAlgorithmProperty function configures the code generator to apply the following methods when replacing code for the lookup1D function:

  • Clip extrapolation

  • Linear interpolation

  • Binary or linear index search

hLib = RTW.TflTable;

hEnt = RTW.TflCFunctionEntry;
hEnt.setTflCFunctionEntryParameters( ...
                    'Key',                      'lookup1D', ...
                    'Priority',                 100, ...
                    'ImplementationName',       'my_Lookup1D_Repl', ...
                    'ImplementationHeaderFile', 'my_Lookup1D.h', ...
                    'ImplementationSourceFile', 'my_Lookup1D.c', ...
                    'GenCallback', 'RTW.copyFileToBuildDir');

arg = hEnt.getTflArgFromString('y1','double');
arg.IOType = 'RTW_IO_OUTPUT';
hEnt.addConceptualArg(arg);

arg = hEnt.getTflArgFromString('u1','double');
hEnt.addConceptualArg(arg);

arg = RTW.TflArgMatrix('u2','RTW_IO_INPUT','double');
arg.DimRange = [0 0; Inf Inf];
hEnt.addConceptualArg(arg);

arg = RTW.TflArgMatrix('u3', 'RTW_IO_INPUT', 'double');
arg.DimRange = [0 0; Inf Inf];
hEnt.addConceptualArg(arg);

hEnt.addAlgorithmProperty('ExtrapMethod', 'Clip');
hEnt.addAlgorithmProperty('InterpMethod', 'Linear point-slope');
hEnt.addAlgorithmProperty('IndexSearchMethod', 'Linear search');
Introduced in R2014b