%% 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.
%
% Copyright 2017-2020 The MathWorks, Inc.

%% 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);
sim(mdl);
open_system([mdl '/ScopeA']);
open_system([mdl '/ScopeB']);

%% 

close_system(mdl, 0);
