User`s guide
Model Coverage for MATLAB Functions
18-23
To collect coverage for these functions, on the Coverage tab of the Coverage Settings
dialog box, select the Simulink Design Verifier coverage metric.
The following section provides model coverage examples for each of these situations.
Examples: Model Coverage for MATLAB Functions
• “Model Coverage for MATLAB Function Blocks” on page 18-23
• “Model Coverage for MATLAB Functions in an External File” on page 18-33
• “Model Coverage for Simulink Design Verifier MATLAB Functions” on page 18-33
Model Coverage for MATLAB Function Blocks
Simulink Verification and Validation software measures model coverage for functions in
a MATLAB Function block.
The following model contains two MATLAB functions in its MATLAB Function block:
In the Configuration Parameters dialog box, on the Solver pane, under Solver options,
the simulation parameters are set as follows:
• Type — Fixed-step
• Solver — discrete (no continuous states)
• Fixed-step size (fundamental sample time) — 1
The MATLAB Function block contains two functions:
• The top-level function, run_intersect_test, sends the coordinates for two
rectangles, one fixed and the other moving, as arguments to rect_intersect.
• The local function, rect_intersect, tests for intersection between the two
rectangles. The origin of the moving rectangle increases by 1 in the x and y directions
with each time step.