How to access streamed signals for custom criteria in Simulink Test?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I would like to access streamed signals (as for Simulation Data Inspector) for custom criteria in Simulink Test. I can find the streamed signals in the results view but cannot find them in the test-object, where all other information about the test is stored. I wondered if thre is a way Simulink Test stores the streamed signals in this object too?
Kind regards
0 Kommentare
Antworten (1)
Abhishek
am 12 Apr. 2017
Bearbeitet: Abhishek
am 12 Apr. 2017
I assume you are using R2016b or earlier when streamed and logged signals were handled differently. You can use the following code in custom criteria to get all the signals in simulation output (including streamed signals).
% Get the output Simulink.sdi.Run object corresponding to the simulation output.
% For equivalence tests, it will be an array of two objects
outputRun = test.TestResult.getOutputRuns;
% get the number of signals in the simulation run
numSigs = outputRun.SignalCount;
% iterate over all signals to get signal data and metadata
for i = 1:numSigs
% this will return an object of type Simulink.sdi.Signal
sig = outputRun.getSignalByIndex(i);
% this will return a struct containing data and time
dataAndTime = sig.dataValues;
end
0 Kommentare
Siehe auch
Kategorien
Mehr zu Results, Reporting, and Test File Management finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!