MATLAB Functions
himl_0001: Usage of standardized MATLAB function headers
| ID: Title | himl_0001: Usage of standardized MATLAB® function headers |
|---|---|
| Description | 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. |
| Model Advisor Checks | Check usage of standardized MATLAB function headers (Simulink Check) |
| References |
|
| See Also |
|
| Last Changed | R2018b |
| Examples | A typical standardized function header includes:
Example: % 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 % |
himl_0002: Strong data typing at MATLAB function boundaries
| ID: Title | himl_0002: Strong data typing at MATLAB function boundaries |
|---|---|
| Description | To support strong data typing at the interfaces of MATLAB functions, explicitly define the interface for input signals, output signals, and parameters, by setting:
|
| Rationale | Defined interfaces:
|
| Model Advisor Checks | Check for MATLAB Function interfaces with inherited properties (Simulink Check) |
| References |
|
| See Also |
|
| Last Changed | R2016a |
| Examples | Recommended: Specify the complexity
and type of input
Not Recommended: Do not specify the complexity and
type of input
Note To modify the input, from the toolbar of the MATLAB Function Block Editor, select Edit Data. |
himl_0003: Complexity of user-defined MATLAB Functions
| ID: Title | himl_0003: Complexity of user-defined MATLAB Functions | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Description | When using MATLAB functions, limit the size and complexity of MATLAB code. The size and complexity of MATLAB functions is characterized by:
| ||||||||||||
| Note | Size and complexity limits can vary across projects. Typical limits might be as described in this table:
| ||||||||||||
| Rationale |
| ||||||||||||
| Model Advisor Checks | Check MATLAB Function metrics (Simulink Check) | ||||||||||||
| References |
| ||||||||||||
| See Also |
| ||||||||||||
| Last Changed | R2021b | ||||||||||||
