Quantcast

Documentation Center

  • Trial Software
  • Product Updates

hilite_system

Highlight Simulink object

Syntax

hilite_system(block_path)
hilite_system(block_path, hilite_scheme)

Description

hilite_system(block_path) highlights a model object using colors specified by the default highlighting scheme. hilite_system(block_path, hilite_scheme) highlights a model object using the foreground and background colors specified in the highlighting scheme.

Input Arguments

block_path

A string in two possible formats:

  • A full block path

  • A traceability tag from the comments of Simulink® Coder™ generated code. Using a traceability tag requires a Simulink Coder license. In this case, the format is <system>/block_name:

    • system is one of the following:

      • The string Root.

      • A unique system number assigned by the Simulink engine.

    • block_name is the name of the source block. If a block name contains a newline character (\n), in the block path string, replace the newline character with a space.

hilite_scheme

String identifying a highlighting scheme name. For more information, see Highlighting Scheme.

Examples

  1. Open a Simulink model. For example, in the MATLAB Command Window, type

    slexAircraftExample
  2. Use the block path to highlight the Controller block.

    hilite_system('slexAircraftExample/Controller')

    In the model diagram, the Controller block is highlighted yellow.

If you have a Simulink Coder license, you can trace generated code to the corresponding source system or block in a model.

  1. Open the Model Configuration Parameters dialog box. In the Solver pane, set solver parameters as follows:

    • Set the solver Type to Fixed-step.

    • Set Fixed step size to 0.1.

  2. Generate code for the model. Code > C/C++ Code > Build Model.

  3. In an editor or within an HTML code generation report, open a generated source or header file.

  4. As you review lines of code, note traceability tags that correspond to code of interest. To highlight a block using a traceability tag, enter:

    hilite_system('<Root>/alpha, rad')

    The following figure shows block alpha, rad highlighted.

    You can also use the hilite_system command to highlight a block within a subsystem. Specify the Aircraft Dynamics Model subsystem using its traceability tag.

    hilite_system('<S1>/Vertical Channel')

More About

expand all

Highlighting Scheme

A highlighting scheme specifies the foreground and background colors for a model object. Possible highlighting scheme names are:

default
none (clears the highlighting for an object)
find
unique
different
user1
user2
user3
user4
user5

You can alter the specification for a highlighting scheme by using the following command:

set_param(0, 'HiliteAncestorsData', HILITE_DATA)

HILITE_DATA is a MATLAB® structure array with the following fields:

  • 'HiliteType': string specifying a highlighting scheme.

  • 'ForegroundColor': string specifying a foreground Color.

  • 'BackgroundColor': string specifying a background Color.

Color

The supported color strings for foreground and background colors are:

black
white
gray
red
orange
yellow
green
darkGreen
blue
lightBlue
cyan
magenta

Tips

  • Calling hilite_system does not clear highlighted objects from previous hilite_system calls.

  • Using a traceability tag for block_path requires a Simulink Coder license. If you call hilite_system with a traceability tag as input, do the following:

    • If you closed and reopened a model, you must update the model before calling hilite_system.

    • If you changed your model, such as adding a block to your diagram, before calling hilite_system, generate new code for the model. When the system hierarchy of the model changes, traceability tags change. If you use a traceability tag from previously generated code, hilite_system might highlight the wrong block.

    • If a block name contains a newline character (\n), it is replaced with a space for readability. When calling hilite_system, in the block path string, replace the newline character with a space.

  • hilite_system might not work for a block, if the block name contains:

    • A single quote (').

    • An asterisk (*), that causes name ambiguity relative to other names in the model. This name ambiguity occurs in a block name or at the end of a block name if an asterisk precedes or follows a slash (/).

    • The character ÿ (char(255)).

See Also

Was this topic helpful?