Main Content

slreq.getExternalURL

Get navigation URL for link source or destination, requirement, test or Simulink model element

Since R2021a

    Description

    navURL = slreq.getExternalURL(myDesignItem) returns a navigation URL to a link source or destination, requirement, test or Simulink® model element specified by 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 rmi httpLink status to check the configured port number. If the httpPort field of the output structure is 0, use rmipref("UnsecureHttpRequests",true) to enable the embedded HTTP server. If the httpPort is a number that is not 31415, close all instances of MATLAB and reopen one instance.

    example

    [navURL,navLabel] = slreq.getExternalURL(myDesignItem) also returns an external navigation label, navLabel.

    example

    Examples

    collapse all

    Open the ShortestPath project. Load the shortest_path_func_reqs requirement set.

    openProject("ShortestPath");
    slreq.load("shortest_path_func_reqs");

    Find the shortest_path link set. Return an array of links in the link set, then get a handle to the first link.

    myLinkSet = slreq.find(Type="LinkSet",Name="shortest_path");
    myLinks = getLinks(myLinkSet);
    myLink = myLinks(1);

    Get a navigation URL to the link source.

    navURL1 = slreq.getExternalURL(myLink.source)
    navURL1 = 
    'http://127.0.0.1:31415/matlab/feval/rmicodenavigate?arguments=[%22shortest_path.m%22,%22738430.825.2%22]'
    

    Get a navigation URL to the link destination.

    navURL2 = slreq.getExternalURL(myLink.destination)
    navURL2 = 
    'http://127.0.0.1:31415/matlab/feval/rmi.navigate?arguments=[%22linktype_rmi_slreq%22,%22shortest_path_func_reqs.slreqx%22,%225%22,%22%22]'
    

    Load the myAddRequirements requirement set.

    rs = slreq.load("myAddRequirements");

    Return an array of the parent requirements in the requirement set. Get a handle to the first requirement in the requirement set.

    reqs = children(rs);
    req = reqs(1);

    Get an external navigation URL for the requirement and a label for the URL.

    [navURL,navLabel] = slreq.getExternalURL(req)
    navURL = 
    'http://127.0.0.1:31415/matlab/feval/rmi.navigate?arguments=[%22linktype_rmi_slreq%22,%22myAddRequirements.slreqx%22,%221%22,%22%22]'
    
    navLabel = 
    'Input u'
    

    Open the CruiseRequirementsExample project. Open the crs_plant model.

    openProject("CruiseRequirementsExample");
    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/vehSp'
    
    [navURL1,navLabel1] = slreq.getExternalURL(subsys)
    navURL1 = 
    'http://127.0.0.1:31415/matlab/feval/rmiobjnavigate?arguments=[%22crs_plant.slx%22,%22:135%22]'
    
    navLabel1 = 
    'vehSp'
    

    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 = 
      State with properties:
    
                         Name: 'first'
                           Id: 48
                         Path: 'crs_plant/shift_logic/gear_state'
                   SSIdNumber: 6
                    Subviewer: [1×1 Stateflow.Chart]
                  Description: ''
                  LabelString: 'first↵'
                  EntryAction: ''
                 DuringAction: ''
                   ExitAction: ''
                     OnAction: {0×1 cell}
                  MooreAction: ''
                     FontSize: 10
                    ArrowSize: 9.2240
                    TestPoint: 0
                        Chart: [1×1 Stateflow.Chart]
              BadIntersection: 0
                     Document: ''
              RequirementInfo: ''
               ExecutionOrder: 0
        ContentPreviewEnabled: 0
                          Tag: []
                   IsSubchart: 0
                    IsGrouped: 0
                        Debug: [1×1 Stateflow.StateDebug]
                  IsCommented: 0
                 EnumTypeName: 'firstModeType'
                     Position: [50.7030 39.5270 85.3400 36.9140]
                  LoggingInfo: [1×1 Stateflow.SigLoggingInfo]
             LogStateActivity: 0
        ASLEnabledViaAncestor: 0
        IsExplicitlyCommented: 0
        IsImplicitlyCommented: 0
                  CommentText: ''
                Decomposition: 'EXCLUSIVE_OR'
                         Type: 'OR'
                 InlineOption: 'Auto'
                      Machine: [1×1 Stateflow.Machine]
                HasOutputData: 0
         OutputMonitoringMode: 'SelfActivity'
                   OutputData: []
    
    
    [navURL2,navLabel2] = slreq.getExternalURL(firstState)
    navURL2 = 
    'http://127.0.0.1:31415/matlab/feval/rmiobjnavigate?arguments=[%22crs_plant.slx%22,%22:413:6%22]'
    
    navLabel2 = 
    'first'
    

    Input Arguments

    collapse all

    Item in MATLAB or Simulink, specified as:

    Output Arguments

    collapse all

    External navigation URL, returned as a 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

    Introduced in R2021a

    See Also

    | (Simulink) | (Simulink) | (Stateflow) | (Simulink Test)