Access Test Case Data Using MATLAB Element

You can access the data from a Test Case Data test vector by using a MATLAB element in a test that has a Test Case Data test vector. You could use the data for a variety of reasons, such as writing it to a CSV file, calling a custom function, or creating a plot.

If you have a Test Case Data test vector called TestVector1 with a signal called Signal1, and use a custom analysis function in your test, the following are examples of code you could use in a MATLAB element to access the signal's data for your function.

Get a cell array of signal names stored in the Test Case Data test vector.

signalNames = getValue(TestVector1); 

Get the timeseries object.

Signal1Timeseries = getValue(TestVector1, 'Signal1'); 

Get the Time and Data out.

time = Signal1Timeseries.Time; 
data = Signal1Timeseries.Data;

Call your custom function.

myCustomAnalysisFunction(time, data) 
Was this topic helpful?