주요 콘텐츠

hilite_system

R2026b

Highlight block, signal line, or annotation

Description

hilite_system(obj) highlights the specified block, signal line, or annotation in an open model using the default highlight style. Each use of the function adds to the highlighting. Highlighting is not saved with the model.

example

hilite_system(obj,style) uses the specified highlighting style.

example

Examples

collapse all

Suppose you have a model named myModel. The model contains an Integrator block named myBlock. A branched signal line connects the output port of myBlock to multiple other blocks. Highlight the signal line, including all branches.

In this example, you want to get the handle of a signal line, including all branches. You can get the line handle by using the get_param function to query which signal lines connect to a given block. If you query the block connected to the signal line at the output port, the get_param function returns the handle of the entire signal line, including all branches. If you query one of the blocks connected to the signal line at the input port, the function returns the handle of the branch connected to that block. In this example, you want to get the line handle of the entire signal line, so you want to query the block connected to signal line at the output port.

Get the handles of all signal lines connected to the Integrator block.

hAll = get_param("myModel/myBlock","LineHandles");

Get the handle of the signal line connected to the output port of the Integrator block.

h = hAll.Outport;

Highlight the signal line, including all branches, in the default style.

hilite_system(h);

Suppose you have a model named myModel that containing a block named myBlock1 and a block named myBlock2.

Highlight the blocks in the default style.

blockPaths = "myModel/"+["myBlock1";"myBlock2"];
hilite_system(blockPaths);

Highlight the blocks in the find style.

hilite_system(blockPaths,"find");

Suppose you have a model named myModel containing a highlighted block named myBlock.

Remove the highlighting from the block by setting the highlighting style to none.

hilite_system("myModel/myBlock","none")

Alternatively, remove the highlighting interactively by pressing Ctrl+Shift+H. On macOS, press Command+Shift+H.

Suppose you have a model named myModel. The model contains an Integrator block. A branched signal line connects the output port of the Integrator block to multiple other blocks, including a block named myBlock. Highlight the branch of the signal line connected to myBlock.

In this example, you want to get the handle of the branch of a signal line. You can get the line handle by using the get_param function to query which signal lines connect to a given block. If you query the block connected to the signal line at the output port, the get_param function returns the handle of the entire signal line, including all branches. If you query one of the blocks connected to the signal line at the input port, the function returns the handle of the branch connected to that block. In this example, you want to get the line handle of a branch, so you want to query the block connected to that branch at the input port.

Get the handles of all signal lines connected to myBlock.

hAll = get_param("myModel/myBlock","LineHandles");

Get the handle of the signal line connected to the input port of myBlock.

h = hAll.Inport;

Highlight the branch of the signal line connected to myBlock in the default style.

hilite_system(h);

Suppose you have a model named myModel. In the model, highlight all annotations containing the word note.

Get the handles of all annotations containing the word note.

h = find_system("myModel",FindAll="on",Regexp="on",CaseSensitive="off",Name=".*note.*");

Highlight the annotations in the default style.

hilite_system(h);

You can customize a highlighting style by setting the value of the HiliteAncestorsData parameter on the root-level model using the set_param function.

set_param(0,HiliteAncestorsData=hiliteData)

Specify hiliteData as a structure array with these fields:

  • 'HiliteType' — Highlighting style to customize, such as 'user1', 'debug', or 'error'

  • 'ForegroundColor' — Color for block fill

  • 'BackgroundColor' — Color for block outline

The supported values for 'ForegroundColor' and 'BackgroundColor' are:

  • 'black'

  • 'white'

  • 'gray'

  • 'red'

  • 'orange'

  • 'yellow'

  • 'green'

  • 'darkGreen'

  • 'blue'

  • 'lightBlue'

  • 'cyan'

  • 'magenta'

Customize the debug highlighting style.

myHiliteData = struct(HiliteType='debug',ForegroundColor='darkBlue',BackgroundColor='magenta');
set_param(0,HiliteAncestorsData=myHiliteData);

Suppose you have a model named myModel containing a block named myBlock. Highlight the block using the customized debug style.

hilite_system("myModel/myBlock","debug");

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

Open the RollAxisAutopilot model.

openExample("ecoder/GettingStartedEcoderExample")
open_system("RollAxisAutopilot");

Generate code for the model. In the Simulink® Toolstrip, on the Apps tab, under Code Generation, click Embedded Coder. The C Code tab appears in the toolstrip. On the C Code tab, click Build.

In an editor or in the code generation report, open a generated source or header file. As you review lines of code, note traceability tags that correspond to code of interest.

In the RollAsixAutopilot.c file, this line is selected: Inport: '<Root>/Turn_Knob'. In the RollAxisAutopilot model, the Inport block named Turn_Knob is selected.

Highlight a block using a traceability tag.

hilite_system("<Root>/Turn_Knob")

Highlight a block in a subsystem.

hilite_system("<S1>/RateGain")

Input Arguments

collapse all

One or more blocks, signal lines, or annotations to highlight, specified as one of these:

  • Handles

    To highlight a signal line, specify either the handle of the signal line or the handle of a port connected to the signal line.

  • Block paths, formatted as a string, string array, character vector, or cell array of character vectors.

  • Simulink.BlockPath objects

  • Simulink identifiers

  • Traceability tags from the comments of Simulink Coder generated code

    Using a traceability tag requires a Simulink Coder license.

For information about getting handles and paths, see Get Handles and Paths.

The format for a traceability tag is <model>/block, where model is either:

  • Root

  • Unique model number assigned by Simulink during code generation

Example: "myModel/myBlock"

Example: ["myModel/myBlock1","myModel/myBlock2"]

Example: "<Root>/myBlock"

Data Types: double | array of doubles | string | string array | character vector | cell array of character vectors | Simulink.BlockPath object

Highlighting style, specified as one of these values. You can customize the appearance of any of the styles. See Highlight Using a Custom Style.

  • "default" — Default color scheme: red outline, yellow fill.

  • "none" — Clears the highlight.

    To clear all highlighting, press Ctrl+Shift+H. On macOS, press ⌘+Shift+H instead.

  • "debug" — Uses default color scheme.

  • "different" — Applies red outline, white fill.

  • "error" — Uses default color scheme.

  • "fade" — Applies gray outline, white fill.

  • "find" — Applies dark blue outline, blue fill.

  • "lineTrace" — Applies red outline, blue fill.

  • "unique" — Dark blue outline, white fill.

  • "user1", "user2", "user3", "user4", "user5" — Applies custom highlight: black outline, white fill by default (i.e., no highlight).

In addition, you can use these color schemes. The first word is the outline and the second is the fill color.

  • "orangeWhite"

  • "blackWhite"

  • "redWhite"

  • "blueWhite"

  • "greenWhite"

Data Types: string | character vector

Version History

Introduced before R2006a

See Also

(Embedded Coder) |