Main Content

na_0016: Source lines of MATLAB Functions

Sub ID Recommendations

  • NA-MAAB — a

  • JMAAB — Not supported

MATLAB Versions

All

Rule

Sub ID a

The length of MATLAB® functions shall be limited. The recommended limit is 60 lines of code. Sub-functions can use an additional 60 lines of code.

This restriction applies to MATLAB functions that reside in the Simulink® block diagram and external MATLAB files with a .m extension.

Custom Parameter

Maximum effective lines of code per function

Rationale

Sub ID a:

  • Improves readability and workflow

  • Code generation may not be possible.

Verification

Model Advisor check: Check MATLAB Function metrics (Simulink Check)

Last Changed

R2020a

Introduced in R2020a