How to disable the display of coverage report once the simulation is stopped

24 views (last 30 days)
I am in a situation where I need to collect cumulative coverage after multiple simulation restarts. Right now, whenever I hit the stop button, the coverage report is getting generated and it consumes some time, instead am wondering if I can disable the coverage report geneartion and instead save it to a workspace variable and generate the reports at once after all my runs?

Answers (1)

Epsilon
Epsilon on 17 Jan 2025 at 5:31
Hi Prasad,
It is not possible to disable coverage report in the model configuration settings or in the Simulink Coverage app as far as I know. However, you can store the coverage data in the workspace for each run if the coverage analysis is done via a script. This data can then be used to generate the report at the end of the iterations.
Here is an example of the implementation:
load_system('slvnvdemo_ratelim_harness');
%Set up the coverage parameters
paramStruct.CovEnable = 'on';
paramStruct.CovScope = 'Subsystem';
paramStruct.CovPath = '/Adjustable Rate Limiter';
paramStruct.StartTime = '0.0';
paramStruct.StopTime = '2.0';
%setup a test
load within_lim.mat;
%loop to simulate and store coverage data
for i = 1:5
% Generate a unique coverage data name for each iteration
covSaveName = sprintf('covData%d', i);
% Set the coverage save name parameter
paramStruct.CovSaveName = covSaveName;
% Simulate the model using |sim| with |paramStruct| as an additional input
% to collect coverage data using the specified parameters.
simOut = sim('slvnvdemo_ratelim_harness',paramStruct);
% Use |cvsave| to save the coverage results. The first input is the name of
% the coverage data file, and the second input is the |cvdata| object.
cvsave(covSaveName,covData);
end
%generate the report
cvhtml('covReport',covData1,covData2,covData3,covData4,covData5,'-sRT=1');
For further information please refer to the following documentation:
Hope it helps.

Products


Release

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!