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 implFunc to the block replacement entry object blockEntry. When code replacement occurs for the block replacement entry, the implementation function replaces the model system function modelFunc that you specify, such as the initialize, update, or terminate function.

Input Arguments

expand all

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

Model system function for the implementation function to replace, specified as 'initialize', 'update', 'output', or 'terminate'.

Example: 'initialize'

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

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