Main Content

addImplementation

Class: RTW.TflBlockEntry
Namespace: RTW

Add implementation function to block replacement entry

Since R2024a

Syntax

RTW.TflBlockEntry.addImplementation(blockEntry,modelFunc,implFunc)

Description

RTW.TflBlockEntry.addImplementation(blockEntry,modelFunc,implFunc) adds the specified implementation function to the block entry object. When code replacement occurs for the block entry, the implementation function replaces the model system function that you specify, such as the initialize, update, or terminate function.

Input Arguments

expand all

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

Example: RTW.TflBlockEntry

Model system function for the implementation function to replace, specified as a string.

Example: 'initialize'

Implementation function that replaces the model system function, specified as an RTW.CImplementation object.

Example: RTW.CImplementation

Examples

expand all

Create a block replacement entry that uses different implementation functions to replace the initialize and terminate functions for a Discrete FIR Filter block.

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

implInit = RTW.CImplementation;
implInit.Name = 'filterInit';

addImplementation(entry,'initialize', implInit);

implTerm = RTW.CImplementation;
implTerm.Name = 'filterTerm';

addImplementation(entry,'terminate', implTerm);

When the generated code replaces a Discrete FIR Filter block using this entry, the code uses the initialize function filterInit and the terminate function filterTerm.

Version History

Introduced in R2024a