Main Content

Check usage of standardized MATLAB function headers

Check ID: mathworks.hism.himl_0001


This check inspects all MATLAB functions in the model, local functions, and referenced MATLAB files for standardized function headers and checks for these details:

  • Function name

  • Function description

  • Description of input variables

  • Description of output variables

Following is an example of how to define function headers:

%<Function Name> - Description of the function

%<Input variable 1> - Description of input variable 1

%<Input variable 2> - Description of input variable 2

%<Output variable 1> - Description of output variable 1

Available with Simulink® Check™.

Check Parameterization

You can set the following configuration through Model Advisor Configuration Editor.

Select the MATLAB Function header format type, and the custom header format and configure the description tags from the Header format typeand Custom header formatinput parameters. The format for the Custom header format should be of a string type with comma separated tags.

By default, the Header format type is set to Default and the Custom header format parameter is Description, Input,Output.

For example, considering the default values (Description, Input, Output), each of the layer in the model should have the description format as following:

Description: <model description>

Input: <input information>

Output: <output information>

Results and Recommended Actions

ConditionRecommended Action
MATLAB functions use nonstandard function headers.

Consider adding a function header to the functions according to these guidelines:

  • Must be a valid MATLAB comment.

  • Must immediately follow the function signature.

  • Must have a "Function Description" section.

  • Must have an "Inputs Description" section.

  • Must have an "Outputs Description" section.

Capabilities and Limitations

  • This check only analyzes the functions that are directly referenced by the Simulink model.

  • You can configure the check to run on referenced MATLAB files using the input parameter Check .m files referenced in the model in the Configuration Editor. By default this parameter is selected.

  • Analyzes content in masked subsystems. By default, the input parameter Look under masks is set to all.

  • Analyzes content of library-linked blocks. By default, the input parameter Follow links is set to on.

  • Allows exclusions of blocks and charts.

See Also