MATLAB Examples

Modeling Reusable Components Using Multiply Instanced Simulink Functions

In this example, the model slexCounterFunctionMdlRef contains a Simulink Function update() which maintains a counter. Multiple instancing provides the ability to reuse this logic as CounterA and CounterB in this application model.

Contents

Overview

The qualified calling notation CounterA.update and CounterB.update is used to distinguish the two different instances of the counter logic. Note that each instance may be called from multiple caller blocks as illustrated in this example.

mdl = 'slexMultiInstanceFunctionsExample';
open_system(mdl);
curDir = pwd;
cd(tempdir);

Closing the Models

close_system(mdl, 0);
cd(curDir);