Main Content

na_0017: Number of called function levels

Since R2020a

Guideline Publication

Control Algorithm Modeling Guidelines - Using MATLAB®, Simulink®, and Stateflow®

Sub ID Recommendations

  • NA-MAAB — a

  • JMAAB — Not supported

MATLAB Versions



Sub ID a

The number of sub-function levels shall be limited, typically to three levels.

MATLAB Function blocks that reside in the Simulink block diagram level counts as the first level, unless it is simply a wrapper for an external MATLAB file with a .m extension. This includes functions that are defined within the block and those in separate .m files.


The following function types are excluded from the number of levels:

  • Standard utility functions, such as built-in functions sqrt or log

  • Commonly used custom utility functions

Custom Parameter

Maximum function call levels


Sub ID a:

  • Improves readability and testability


Model Advisor check: Check the number of function calls in MATLAB Function blocks (Simulink Check)

Last Changed


Version History

Introduced in R2020a