Main Content

addLoggedSignal

Class: sltest.testmanager.LoggedSignalSet
Namespace: sltest.testmanager

Add a logged signal to a set

Description

obj = addLoggedSignal(lgset,BlockPath,PortIndex) creates and adds an sltest.testmanager.LoggedSignal object to a sltest.testmanager.LoggedSignalSet object. You must open or load the model to add signals from the model.

example

obj = addLoggedSignal(lgset,BlockPath,PortIndex) creates and adds an sltest.testmanager.LoggedSignal object to a sltest.testmanager.LoggedSignalSet object. You must open or load the model to add signals from the model.

obj = addLoggedSignal(___,'LeafElement',busleaf) specifies the bus leaf element to include as a logged signal. busleaf is a string. If the signal has nested buses, specify the full path to the leaf ('parentLeaf.childLeaf').

Input Arguments

expand all

Logged signal set object contained in a test case.

Simulink.BlockPath object that uniquely identifies the block that outputs the signal.

Index of the output port for the block designated by BlockPath, starting from 1.

Examples

expand all

Open the sldemo_absbrake model.

openExample("sldemo_absbrake")

Create the test file, test suite and test case structure. Specify the model to use with the test case. Then, create a signal set and add it to the test case.

tf = sltest.testmanager.TestFile("addSigs_testfile");
ts = sltest.testmanager.TestSuite(tf,"addsigs_testsuite");
tc = sltest.testmanager.TestCase(ts,"baseline","addsigs_testcase");

setProperty(tc,Model="sldemo_absbrake");
sigset = addLoggedSignalSet(tc);

Open the Vehicle Dynamics block and then the Vehicle block. Select the Vehicle Speed block. Then, enter gcb to obtain the full block path. Use the returned path to create a Simulink.BlockPath object. Then, add signals to the signal set.

blkpath=["sldemo_absbrake/" + ...
    "Vehicle Dynamics/Vehicle  /Vehicle Speed"];
bPath = Simulink.BlockPath(blkpath);

sig1 = sigset.addLoggedSignal(bPath,1);
sig2 = sigset.addLoggedSignal(bPath,2);

Version History

Introduced in R2019a