主要内容

himl_0001: Usage of standardized MATLAB function headers

R2026b

Use a standardized header to document the purpose and use of MATLAB functions

Usage: High-Integrity System Modeling

Guideline ID: himl_0001

Rules

himl_0001: Usage of standardized MATLAB® function headers

When using MATLAB functions, use a standardized header to provide information about the purpose and use of the function.

Rationale

A standardized header improves the readability and documentation of MATLAB functions. The header should provide a function description and usage information.

Verification

Check usage of standardized MATLAB function headers (Simulink Check)

Example

A typical standardized function header includes:

  • Function name

  • Description

  • Inputs and outputs (if possible, include size and type)

  • Assumptions and limitations

  • Revision history

% FUNCTION NAME:
%   avg
%
% DESCRIPTION:
%   Compute the average of three inputs
%
% INPUT:
%   in1 - (double) Input one
%   in2 - (double) Input two
%   in3 - (double) Input three
%
% OUTPUT:
%   out - (double) Calculated average of the three inputs
%
% ASSUMPTIONS AND LIMITATIONS:
%   None
%
% REVISION HISTORY:
%   05/02/2018 - mmyers
%       * Initial implementation
%

Industry Standards

  • DO-331, Section MB.6.3.4.e – Source code is traceable to low-level requirements

  • ISO 26262-6, Table 1 (1g) – Use of style guides

Version History

Introduced in R2013a

expand all