Scoped Simulink Function Blocks in Subsystems - MATLAB & Simulink (original) (raw)

Main Content

The scope of a Simulink® function is defined in its parent subsystem within the context of a model. If you place a function in any Subsystem block, access to the function from outside the model is prohibited by default. In both cases, the Trigger block Function visibility parameter is set to scoped. The Simulink Function block can be located:

Resolve to a Function Hierarchically

Placing a scoped Simulink Function block within any Subsystem block (virtual or atomic) limits access to the function and removes the function name from the global name space. When a function caller resolves to a function hierarchically, it looks for the function using the following rules:

If a function caller resolves to a function hierarchically, you can call the function without qualifying the function name:

Resolve to a Function by Qualification

When you place a Simulink Function block in a virtual Subsystem block, the function name is not visible outside of the subsystem. However, you can call the function by qualifying the function name with the Subsystem block name. When a function caller resolves to a qualified function hierarchically, it looks for the virtual Subsystem block containing the function using the following rules:

If a function caller resolves to a virtual Subsystem block with a scoped function, you can call the function by qualifying the function name:

See Also

Simulink Function | Argument Inport | Argument Outport | Function Caller | MATLAB Function | Subsystem

Topics