in custom criteria function of simulink test the test.sltest_output is empty

2 views (last 30 days)
I am trying to use custom criteria by checking the custom criteria function in the test manager. The goal is to verify a signal acquired during real time testing on Speedgoat reaches two different values during testing.
I cannot access the signal data within the custom criteria function. I have logged the signal in the model, I have the logsout variable in the workspace after the model is executed, in the simulation output panel I added the signal, but the test sltest_simout is empty.
How can I access the data acquired by the real time test hardware within the custom criteria?

Answers (1)

Dimitri MANKOV
Dimitri MANKOV on 25 Oct 2021
Hi Stefano,
I would recommend logging the data in Simulink Real-Time using the Simuliation Data Inspector (SDI), which would enable you to base your custom criteria function on the following syntax :
% Extract desired run IDs from SDI
runID_List = Simulink.sdi.getAllRunIDs;
runID = runID_List(end);
% Export logged data to workspace
simDataset = Simulink.sdi.exportRun(runID);
% Unpack the data
signal_A = simDataset{1}.Values.Data(:,1);
signal_B = simDataset{1}.Values.Data(:,2);
...
Hope that's helpful!
Best,
Dimitri

Community Treasure Hunt

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

Start Hunting!