Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

How a Simulink Function Behaves When Called from Multiple Sites

If you call a Simulink® function from multiple sites in a chart, all call sites share the state of the function variables. For example, suppose you have a chart with two calls to the same Simulink function at each time step.

The function f contains a block diagram that increments a counter by 1 each time the function executes.

At each time step, the function f is called twice, which causes the counter to increment by 2. Because all call sites share the value of this counter, the data y and y1 increment by 2 at each time step.

    Note:   This behavior also applies to external function-call subsystems in a Simulink model. For more information, see Function-Call Subsystems (Simulink).

Related Topics

Was this topic helpful?