Main Content

mp_0032: Function header information

Since R2024b

Guideline Publication

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

Sub ID Recommendations

  • JMAAB — a

MATLAB Versions

All

Rule

Sub ID a

Necessary information shall be described in the function header.

Supplementary Information

The descriptive items can include an overview, processing details, input and output arguments, management information and other relevant information. The combination of descriptive items shall be adjusted for main functions and sub-functions as needed.

Example — Correct
function ret = sample(arg1)
% Overview
% sample program
% Processing details
% Adds arg1 and foo and returns the value
% Arguments
% arg1 : First term
% Return Value
% ret : Result of addition
% Change History
% -------------------------------
% 2018/3/14 Created
% -------------------------------
% 2018/3/30 Added comments

foo = 3;
ret = arg1 + foo;
end
Custom Parameter

Descriptive items for the function header.

Rationale

Sub ID a:

  • Readability and maintainability is improved by clearly specifying the information to be shared.

Verification

Model Advisor check: Check function headers (Simulink Check)

Last Changed

R2024b

Version History

Introduced in R2024b