- You can run the test case and in the "Results and Artifacts" tab you can observe simulation outputs for each iteration defined in the test case. You can export simulation outputs associated with each test case as well.
- For more details on creating iterations, refer to this documentation: https://www.mathworks.com/help/sltest/ug/run-multiple-combinations-of-tests-using-iterations.html
How can I output logged signals from successive coverage tests?
1 view (last 30 days)
Show older comments
MathWorks Support Team
on 14 Apr 2023
Answered: MathWorks Support Team
on 14 Apr 2023
I am trying to save logged signals in a simulation while running coverage tests. I have several scenarios defined in a "Signal Builder" block, and I run them all in series using the "Run all and produce coverage" button within this block. I have a few signals logged in this simulation that I would like to save to the base workspace after each test. Is this possible, and what is the best workflow to achieve this?
Accepted Answer
MathWorks Support Team
on 14 Apr 2023
There are two suggested ways to log the simulation output signals along with coverage analysis:
1) Using Simulink Test: If you have a license for Simulink Test, you can use test case iterations to visualize and store simulation output for logged signals for each test case simulation defined in "Signal Builder" or "Signal Editor".
2) Using Coverage APIs: See the following sample code. All the simulations outputs for logged signals from each coverage run will be stored in the variable "simOutputForRuns".
model_name = 'Roboshift_CalibrationManager';
if ~bdIsLoaded(model_name)
load_system(model_name);
end
sb_block = char(find_system(model_name,'SearchDepth',1,'MaskType','Sigbuilder block'));
time = signalbuilder(sb_block(1,:));
% Create test specification for input modeltestObj = cvtest(model_name);
% Check to see if there is only one group.if iscell(time)
numtabs = size(time, 2);
else
numtabs = 1;
end
% Loop through signal builder groupsfor k = 1:numtabs
signalbuilder(sb_block,'activegroup', k);
% Setting "LoggingToFile" option as OFF so that data is available at Base Workspace
[cvdo,simOut] = cvsim(testObj,'LoggingToFile','off');
simOutputForRuns{k} = simOut.logsout;
if k==1
cvdo_total = cvdo;
else
cvdo_total = cvdo+cvdo_total;
end
end
cvhtml([model_name '_covReport'],cvdo_total,'-sRT=1');
0 Comments
More Answers (0)
See Also
Categories
Find more on Outputs in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!