Skip to Main Content Skip to Search
Product Documentation

Navigating to Simulink Objects from External Documents

The RMI includes several functions that simplify creating navigation interfaces in external documents. The external application that displays your document must support an application programming interface (API) for communicating with the MATLAB software.

Providing Unique Object Identifiers

Whenever you create a requirement link for a Simulink or Stateflow object, the RMI uses a globally unique identifier for that object. This identifier identified the object. The identifier does not change if you rename or move the object, or add or delete requirement links. The RMI uses the unique identifier only to resolve an object within a model.

Using the rmiobjnavigate Function

The rmiobjnavigate function identifies the Simulink or Stateflow object, highlights that object, and brings the editor window to the front of the screen. When you navigate to a Simulink model from an external application, invoke this function.

The first time you navigate to an item in a particular model, you might experience a slight delay while the software initializes the communication API and the internal data structures. You do not experience a long delay on subsequent navigation.

Determining the Navigation Command

To create a requirement link for a Simulink or Stateflow object, at the MATLAB prompt, use the following command to find the navigation command string, where obj is a handle or a uniquely resolved name for the object:

[ navCmd, objPath ] = rmi('navCmd', obj);

The return values of the navCmd method are:

Send the navCmd strings to the MATLAB software for evaluation when navigating from the external application to the object obj in the Simulink model. Use and objPath string to visually identify the target object in the requirements document.

Using the ActiveX Navigation Control

The RMI uses software that includes a special Microsoft ActiveX control to enable navigation to Simulink objects from Microsoft Word and Excel documents. You can use this same control in any other application that supports ActiveX within its documents.

The control is derived from a push button and has the Simulink icon. There are two instance properties that define how the control works. The tooltipstring property is the string that is displayed in the control ToolTip. The MLEvalCmd property is the string that you pass to the MATLAB software for evaluation when you click the control.

Typical Code Sequence for Establishing Navigation Controls

When you create an interface to an external tool, you can automate the procedure for establishing links. This way, you do not need to manually update the dialog box fields. This type of automation occurs as part of the selection-based linking for certain built-in types, such as Microsoft Word and Excel documents.

To automate the procedure for establishing links:

  1. Select a Simulink or Stateflow object and an item in the external document.

  2. Invoke the link creation action either from a Simulink menu or command, or a similar mechanism in the external application.

  3. Identify the document and current item using the scripting capability of the external tool. Pass this information to the MATLAB software. Create a requirement link on the selected object using the RMI API as follows:

    1. Create an empty link structure using the following command:

      rmi('createempty')
    2. Fill in the link structure fields based on the target location in the requirements document.

    3. Attach the link to the object using the following command:

      rmi('cat')
  4. Determine the MATLAB navigation command string that you must embed in the external tool, using the navCmd method:

    [ navCmd, objPath ] = rmi('navCmd',obj)
  5. Create a navigation item in the external document using the scripting capability of the external tool. Set the MATLAB navigation command string in the property.

    When using ActiveX navigation objects provided by the external tool, set the MLEvalCmd property to the navCmd and set the tooltipstring property to objPath.

You define the MATLAB code implementation of this procedure as the SelectionLinkFcn function in the link type definition file. The following files in matlabroot\toolbox\slvnv\reqmgt\private contain examples of how to implement this functionality:

linktype_rmi_doors.m
linktype_rmi_excel.m
linktype_rmi_word.m
  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS