Convert link source or destination information from structure to model object type



ot = slreq.structToObj(linkinfo) converts the source or destination link information in the structure linkinfo to the corresponding object type, ot. The object type returned can include Simulink® blocks, Simulink Test™ test cases, or other object types compatible with Simulink Requirements™.


collapse all

This example shows how to get the structure containing unique requirement source and destination information, then convert the structure information to the specific source and destination model entity.

Load Model, Requirement Set, and Links

reqset = slreq.load('original_thrust_reverser_requirements.slreqx');
linkset = slreq.load('reqs_validation_property_proving_original_model.slmx');

For a Link Set

Get sources from a link set, get a single source, and convert the structure to the model entity.

linkSources = sources(linkset);
linkSource1 = linkSources(1);
modelSource1 = slreq.structToObj(linkSource1);

For a Link

Get a link from the link set, get the source and destination for that link.

links = getLinks(linkset);
link2 = links(2);
linkSource2 = source(link2);
linkDest2 = destination(link2);

Convert the source and destination structure to the model entity.

modelSource2 = slreq.structToObj(linkSource2);
modelDest2 = slreq.structToObj(linkDest2);

Clear Example Files

Cleanup commands -- close the open model, and clear and close the open requirement and link set.


Input Arguments

collapse all

linkinfo contains source artifact and unique identification information for particular links, as returned by

Example: struct with fields

Data Types: struct

Output Arguments

collapse all

ot is the requirement, model, or data entity corresponding to the source artifact and unique identification in linkinfo. The value of ot depends on the type of entity the Link has as source or destination.

Introduced in R2018a