%% Use Multiple Coverage Filter Files for a Simulation
% If you have multiple filter files that each contain their own set of
% rules, you can apply them to a coverage result set by creating a cell
% array of the filter file names or path names. In this example, you apply
% two filter files to a single |cvdata| object and then view the report to
% see that the filters are applied.

% Copyright 2020 The MathWorks, Inc.

%%
% Load the |slvnvdemo_covfilt| model into memory.

modelName = 'slvnvdemo_covfilt';
load_system(modelName)

%%
% Set the coverage settings by using a |Simulink.SimulationInput| object
% and simulate the model using |sim|.

simIn = Simulink.SimulationInput(modelName);
simIn = setModelParameter(simIn,'CovEnable','on');
simIn = setModelParameter(simIn,'CovMetricStructuralLevel','MCDC');
simIn = setModelParameter(simIn,'CovSaveSingleToWorkspaceVar','on');
simIn = setModelParameter(simIn,'CovSaveName','covData');
simOut = sim(simIn);


%%
% Apply the two filters to the |cvdata| object by assigning them to the
% filter property as a cell array.

covData.filter = {'filter_1','filter_2'};
cvhtml('twoFiltersCovData',covData);

%%
% You can see the applied coverage filters in the *Objects Filtered from
% Coverage Analysis* section of the coverage report.
