slreq.getExternalURL
Get navigation URL for link source or destination, requirement, test or Simulink model element
Syntax
Description
returns a navigation URL to a link source or destination, requirement, test or Simulink® model element specified by navURL
= slreq.getExternalURL(myDesignItem
)myDesignItem
.
Note
The MATLAB® embedded web server must run on HTTP port 31415 to create the navigation
URLs. If your MATLAB session is not configured for this HTTP port number, an
error occurs when you try to create a link. Use
connector.port
to check the configured port number. If
connector.port
returns 0
, use
rmipref('UnsecureHttpRequests',true)
to enable the embedded HTTP
server. If connector.port
returns a number that is not
31415
, close all instances of MATLAB and reopen one instance.
[
also returns an external navigation label, navURL
,navLabel
] = slreq.getExternalURL(myDesignItem
)navLabel
.
Examples
Get a Navigation URL for a Link Source or Destination
Open the Requirements Definition for a Cruise Control Model project. Load the crs_req
requirement set.
slreqCCProjectStart;
slreq.load('crs_req');
Find the crs_req
link set. Find the link with description #9: Enable Switch Detection
.
myLinkSet = slreq.find('Type','LinkSet','Name','crs_req'); myLink = find(myLinkSet,'Description','#9: Enable Switch Detection')
myLink = Link with properties: Type: 'Derive' Description: '#9: Enable Switch Detection' Keywords: {} Rationale: '' CreatedOn: 20-May-2017 13:14:10 CreatedBy: 'itoy' ModifiedOn: 02-Feb-2018 14:28:04 ModifiedBy: 'itoy' Revision: 4 SID: 1 Comments: [0×0 struct]
Get a navigation URL to the link source.
navURL1 = slreq.getExternalURL(myLink.source)
navURL1 = 'http://localhost:31415/matlab/feval/rmi.navigate?arguments=[%22linktype_rmi_slreq%22,%22crs_req.slreqx%22,%2210%22,%22%22]'
Get a navigation URL to the link destination.
navURL2 = slreq.getExternalURL(myLink.destination)
navURL2 = 'http://localhost:31415/matlab/feval/rmi.navigate?arguments=[%22linktype_rmi_slreq%22,%22crs_req_func_spec.slreqx%22,%229%22,%22%22]'
Cleanup
Clear the loaded requirement sets and link sets.
slreq.clear;
Get a Navigation URL for a Requirement Object
Open the Requirements Definition for a Cruise Control Model project. Load the crs_req_func_spec
requirement set and open it in the Requirements Editor.
slreqCCProjectStart; rs = slreq.load("crs_req"); rs2 = slreq.open("crs_req_func_spec");
In the Requirements Editor, in the crs_req_func_spec
requirement set, select the requirement with ID #1
. Get an API object for the requirement using slreq.getCurrentObject
. Then get an external navigation URL for the requirement and a label for the URL.
req = slreq.getCurrentObject
req = Requirement with properties: Type: 'Functional' Id: '#1' Summary: 'Driver Switch Request Handling' Description: '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">↵<html><head><meta name="qrichtext" content="1" /><style type="text/css">↵p, li { white-space: pre-wrap; }↵</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:10pt; font-weight:400; font-style:normal;">↵<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Handle switch operations by the driver to determine the command for the cruise control system to operate upon.</p>↵<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif';"><br /></p></body></html>' Keywords: {} Rationale: '' CreatedOn: 27-Feb-2017 10:15:38 CreatedBy: 'itoy' ModifiedBy: 'asriram' SID: 1 FileRevision: 46 ModifiedOn: 02-Aug-2017 13:49:40 Dirty: 0 Comments: [0×0 struct] Index: '1'
[navURL1,navLabel1] = slreq.getExternalURL(req)
navURL1 = 'http://localhost:31415/matlab/feval/rmi.navigate?arguments=[%22linktype_rmi_slreq%22,%22crs_req_func_spec.slreqx%22,%221%22,%22%22]'
navLabel1 = 'Driver Switch Request Handling'
Find a justification in the requirement set with ID #72
. Get an external URL navigation URL for the justification and a label for the URL.
jt = find(rs2,"Type","Justification","ID","#72")
jt = Justification with properties: Id: '#72' Summary: 'Non-functional requirement' Description: '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">↵<html><head><meta name="qrichtext" content="1" /><style type="text/css">↵p, li { white-space: pre-wrap; }↵</style></head><body style=" font-family:'Helvetica'; font-size:8pt; font-weight:400; font-style:normal;">↵<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:10pt;">A non-functional requirement that cannot be associated with a model element.</span></p></body></html>' Keywords: {} Rationale: '' CreatedOn: 27-Feb-2017 10:34:22 CreatedBy: 'itoy' ModifiedBy: 'asriram' SID: 72 FileRevision: 1 ModifiedOn: 03-Aug-2017 17:14:44 Dirty: 0 Comments: [0×0 struct] Index: '5.1'
[navURL2,navLabel2] = slreq.getExternalURL(jt)
navURL2 = 'http://localhost:31415/matlab/feval/rmi.navigate?arguments=[%22linktype_rmi_slreq%22,%22crs_req_func_spec.slreqx%22,%2272%22,%22%22]'
navLabel2 = 'Non-functional requirement'
Find all loaded referenced requirements. Get an external navigation URL for the third referenced requirement and a label for the URL.
refs = find(rs,"Type","Reference"); ref = refs(3)
ref = Reference with properties: Id: 'System overview' CustomId: 'System overview' Artifact: 'crs_req.docx' ArtifactId: '?System overview' Domain: 'linktype_rmi_word' UpdatedOn: 02-Feb-2018 13:23:13 CreatedOn: NaT CreatedBy: '' ModifiedBy: '' IsLocked: 1 Summary: 'System overview' Description: '<div class=WordSection1>↵↵<div style='border:none;border-bottom:solid #595959 1.0pt;padding:0in 0in 1.0pt 0in'>↵↵<h1 style='margin-left:0in;text-indent:0in'>System overview</h1>↵↵</div>↵↵</div>' Rationale: '' Keywords: {} Type: 'Functional' SID: 3 FileRevision: 1 ModifiedOn: 03-Aug-2017 17:34:56 Dirty: 0 Comments: [0×0 struct] Index: '2'
[navURL3,navLabel3] = slreq.getExternalURL(ref)
navURL3 = 'http://localhost:31415/matlab/feval/rmi.navigate?arguments=[%22linktype_rmi_slreq%22,%22crs_req.slreqx%22,%223%22,%22%22]'
navLabel3 = 'System overview'
Cleanup
Clear the loaded requirement sets and link sets. Close the Requirements Editor.
slreq.clear;
Get a Navigation URL for a Model Element
Open the Requirements Definition for a Cruise Control Model project. Open the crs_plant
model.
slreqCCProjectStart;
open_system('crs_plant');
Select the Transmission
subsystem and use gcb
or gcbh
to get a path or handle to the subsystem. Then get an external navigation URL to the subsystem and a label for the URL.
subsys = gcb
subsys = 'crs_plant/Transmission'
[navURL1,navLabel1] = slreq.getExternalURL(subsys)
navURL1 = 'http://localhost:31415/matlab/feval/rmiobjnavigate?arguments=[%22crs_plant.slx%22,%22:414%22]'
navLabel1 = 'Transmission'
Look inside the shift_logic
mask by clicking the icon. Select the
first
Stateflow® state and use sfgco
to get a handle to the state. Then get an external navigation URL to the state and a label for the URL.
firstState = sfgco
firstState = Path: 'crs_plant/shift_logic/gear_state' Id: 462 Machine: [1×1 Stateflow.Machine] SSIdNumber: 6 Name: 'first' Description: '' LabelString: 'first↵' FontSize: 10 ArrowSize: 9.2240 TestPoint: 0 Chart: [1×1 Stateflow.Chart] BadIntersection: 0 Subviewer: [1×1 Stateflow.Chart] Document: '' Tag: [] RequirementInfo: '' ExecutionOrder: 0 ContentPreviewEnabled: 0 Position: [1×4 double] Decomposition: 'EXCLUSIVE_OR' Type: 'OR' IsSubchart: 0 IsGrouped: 0 Debug: [1×1 Stateflow.StateDebug] InlineOption: 'Auto' LoggingInfo: [1×1 Stateflow.SigLoggingInfo] HasOutputData: 0 OutputData: [] OutputMonitoringMode: 'SelfActivity' IsExplicitlyCommented: 0 IsImplicitlyCommented: 0 CommentText: ''
[navURL2,navLabel2] = slreq.getExternalURL(firstState)
navURL2 = 'http://localhost:31415/matlab/feval/rmiobjnavigate?arguments=[%22crs_plant.slx%22,%22:413:6%22]'
navLabel2 = 'first'
Cleanup
Clear the loaded requirement sets and link sets. Close all open models.
slreq.clear;
bdclose('all');
Get a Navigation URL for a Simulink Test Case
Open the Requirements Definition for a Cruise Control Model project. Load the DriverSwRequest_Tests
test file.
slreqCCProjectStart;
tf = sltest.testmanager.load('DriverSwRequest_Tests.mldatx');
Get the test suite in the test file.
suite = getTestSuites(tf);
Get the test cases in the test suite. Get an external navigation URL for the first test case and get a label for the navigation URL.
cases = getTestCases(suite)
cases=1×8 object
1×8 TestCase array with properties:
Name
TestFile
TestPath
TestType
RunOnTarget
Parent
Requirements
Description
Enabled
ReasonForDisabling
Tags
case1 = cases(1)
case1 = TestCase with properties: Name: 'Enable button' TestFile: [1×1 sltest.testmanager.TestFile] TestPath: 'DriverSwRequest_Tests > Unit test for DriverSwRequest > Enable button' TestType: 'simulation' RunOnTarget: {[0]} Parent: [1×1 sltest.testmanager.TestSuite] Requirements: [1×1 struct] Description: '' Enabled: 1 Tags: [0×0 string]
[navURL,navLabel] = slreq.getExternalURL(case1)
navURL = 'http://localhost:31415/matlab/feval/rmitmnavigate?arguments=[%22DriverSwRequest_Tests.mldatx%22,%223b7651c7-826b-431c-928b-f1f80a674351%22]'
navLabel = 'Enable button'
Cleanup
Clear the loaded requirement sets and link sets. Clear the loaded test files.
slreq.clear; sltest.testmanager.clear;
Input Arguments
myDesignItem
— Link source or destination, requirement, test, or model element
slreq.link
source or destination structure | Requirements Toolbox™ object | path or handle to model element | Simulink
Test™ object
Item in MATLAB or Simulink, specified as:
slreq.Link
source or destination structureRequirements Toolbox object:
Path or handle to:
Simulink system or block
Stateflow® chart, subchart, state, or transition
System Composer™ model or component
Simulink Test object:
sltest.testmanager.TestFile
(Simulink Test)sltest.testmanager.TestSuite
(Simulink Test)sltest.testmanager.TestCase
(Simulink Test)sltest.testmanager.TestIteration
(Simulink Test)
Output Arguments
navURL
— External navigation URL
character array
External navigation URL, returned as a character array.
navLabel
— External navigation URL label
character array
External navigation URL label, returned as a character array.
Tips
You can copy the external navigation URL to your clipboard for a:
Requirements Toolbox requirement, referenced requirement, or justification
Simulink, Stateflow, or System Composer model element
Simulink data dictionary entry
Right-click one of these items in the Requirements Editor or Simulink Editor and select Copy URL to Clipboard, or select Requirements > Copy URL to Clipboard.
Version History
See Also
slreq.getCurrentObject
| gcb
(Simulink) | gcbh
(Simulink) | sfgco
(Stateflow) | sltest.testmanager.getTestFiles
(Simulink Test)
Beispiel öffnen
Sie haben eine geänderte Version dieses Beispiels. Möchten Sie dieses Beispiel mit Ihren Änderungen öffnen?
MATLAB-Befehl
Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:
Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.
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)