Borrar filtros
Borrar filtros

How to access streamed signals for custom criteria in Simulink Test?

1 visualización (últimos 30 días)
Bastian Ansorge
Bastian Ansorge el 30 de Mzo. de 2017
Editada: Abhishek el 12 de Abr. de 2017
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

Respuestas (1)

Abhishek
Abhishek el 12 de Abr. de 2017
Editada: Abhishek el 12 de Abr. de 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

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by