Introduction
The goal of this set of coding standards that can be automatically checked is to help you write MATLAB code that is Compiler-compatible. The resulting code will be more suitable for deployment using the MATLAB Compiler. For more information on MATLAB Compiler, see the MathWorks website.
If you are looking for more generic coding standards that are not specifically aimed at Coder-compatibility, see our MonkeyProof Coding Standard for MATLAB.
Automatic compliance checking
The coding standards described here can be checked using CC4M by MonkeyProof Solutions.
They are configured in the predefined CoderCompatibility
configurations set available with the tool. For instructions on how to check your code against coding standards, see the video below. The steps are also described below the video.
You can check your code for compliance with the guidelines described here as follows:
- Get CC4M and install per installation instructions.
- Open CC4M in one of two ways:
- Click the shortcut created at the top of the screen next to the documentation search bar: .
- Run
monkeyproof.cc4m.start()
from the command window.
- Select whether you want to check one or more files, all files in a folder, or all files in a MATLAB Project.
- Select what files/folder/project to check.
- Further customization is available, for example checking a folder including or excluding all subfolders.
- Click the Run button at the bottom to start checking your code.
The guidelines that require human judgment or are simply not possible to check statically in MATLAB are not described here.
Guideline template
Every guideline is structured as follows:
Guideline name
ID | A unique guideline identifier. |
Title | Brief description of the guideline. |
Priority | Priority of the guideline can be one of Mandatory, Strongly recommended and Recommended. Exactly what each of these means for your case is up to you to decide. |
Description | A more elaborate description of the guideline. Can include the reasoning behind the guideline: how does your code improve when applying the guideline? |
Rationale | One or multiple words describing what the guideline is about. Examples: Compatibility, Stability. |
avoid
<< a section with examples on what to avoid >>
instead use
<< a section with examples on how to code properly >>