slreq.structToObj
Convert link source or destination information from structure to model object type
Description
Examples
Convert Link Source and Destination to Model Entity
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
load_system("reqs_validation_property_proving_original_model"); 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);
Convert Link Source Information to Test Case
This example shows how to get information for a link source, then convert the information to the corresponding object type. In this example, the source object type is a Simulink Test test case.
Open the project and load the requirement set, link set, and test file.
openProject("CruiseRequirementsSafetyExample"); reqSet = slreq.load("crs_req.slreqx"); linkSet = slreq.load("DriverSwRequest_Tests.slmx"); testFile = sltest.testmanager.load("DriverSwRequest_Tests.mldatx");
Get the links in the link set. Then, get the source information for a link.
linkArray = getLinks(linkSet); link = linkArray(1); linkSource = source(link);
Convert the structure containing the source information for the link to a test case.
testCase = slreq.structToObj(linkSource);
Input Arguments
linkinfo
— Link information
structure array
Link information from a slreq.Link
or slreq.LinkSet
object, specified as a structure array. The fields of the
structure array must contain source artifact and unique identification information for a
link, as returned by these methods:
sources
for aslreq.LinkSet
object.source
for aslreq.Link
object.destination
for aslreq.Link
object.
Example: linkSources = sources(linkset);
slreq.structToObj(linkSources(1))
Example: slreq.structToObj(source(link))
Example: slreq.structToObj(destination(link))
Data Types: struct
Output Arguments
ot
— Requirement, model, or data entity
slreq.Requirement
object | slreq.Reference
object | character vector | ...
Requirement, model, or data entity corresponding to the source artifact and unique
identification information in linkinfo
, returned as one of these
values:
slreq.Requirement
orslreq.Reference
objectCharacter vector that lists the name of a Simulink model or path to a Simulink block or subsystem, a Stateflow® chart, or a System Composer™ port or component
Handle to a Simulink block or subsystem or a System Composer port or component
Stateflow.Chart
(Stateflow),Stateflow.State
(Stateflow), orStateflow.Transition
(Stateflow) objectSimulink.data.dictionary.Entry
(Simulink) objectsltest.testmanager.TestFile
(Simulink Test),sltest.testmanager.TestSuite
(Simulink Test),sltest.testmanager.TestCase
(Simulink Test), orsltest.testmanager.TestIteration
(Simulink Test) objectFault
(Simulink Fault Analyzer),Conditional
(Simulink Fault Analyzer),SpreadsheetCell
(Simulink Fault Analyzer), orSpreadsheetRow
(Simulink Fault Analyzer) objectslreq.TextRange
object
Version History
Introduced in R2018a
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)