Main Content

hilite_system

Highlight block, signal line, port, or annotation

Description

hilite_system(obj) highlights a block, line, port, or annotation in an open model using the default highlight style. Use hilite_system with a port to highlight the signal line attached to the port. Each use of hilite_system 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

Highlight One Block

Open the example. Then, open the slexAircraftExample model.

open_system('slexAircraftExample')

Highlight the Subsystem block named Controller. When you use the default highlighting style, the block is highlighted with a red outline and yellow fill.

hilite_system('slexAircraftExample/Controller')

Highlight Multiple Blocks

You can highlight multiple blocks with a single command.

Highlight the Transfer Fcn block named Actuator Model and the Subsystem block named Aircraft Dynamics Model using a single command. Specify the blocks to highlight as a cell array of character vectors.

hilite_system({'slexAircraftExample/Actuator Model','slexAircraftExample/Aircraft Dynamics Model'})

Alternatively, highlight the blocks sequentially.

hilite_system('slexAircraftExample/Actuator Model')
hilite_system('slexAircraftExample/Aircraft Dynamics Model')

A highlighted block stays highlighted when you highlight additional blocks.

You can highlight a signal line by specifying one of these:

  • The signal line handle

  • The port to which the signal line connects

This example shows how to get the handle of the signal line named wGust. For information on how to highlight signal lines interactvely, see Highlight Signal Sources and Destinations.

Open the example. Then, open the slexAircraftExample model.

open_system('slexAircraftExample')

Get the handle of the signal line named wGust.

h=find_system('slexAircraftExample','FindAll','on','type','line','name','wGust');

Highlight the signal line named x1.

hilite_system(h)

When you use the default highlighting style, the signal line is highlighted in red.

You can highlight a signal line by specifying one of these:

  • The signal line handle

  • The port to which the signal line connects

This example shows how to get the handle of the input port of the Transfer Fcn block named Actuator Model. For information on how to highlight signal lines interactvely, see Highlight Signal Sources and Destinations.

Open the example. Then, open the slexAircraftExample model.

open_system('slexAircraftExample')

Get the handles of all ports in the slexAircraftExample model.

h=find_system('slexAircraftExample','FindAll','on','type','port');

Get the full path names corresponding to the ports.

names=getfullname(h);

Get the index of the ports that contain the keyword 'Actuator\nModel' in the names cell array.

index=find(contains(names,sprintf('Actuator\nModel')));

index(1) corresponds to the input port of the Transfer Fcn block named Actuator Model. index(2) corresponds to the output port.

Highlight the input port.

hilite_system(h(index(1)))

When you use the default highlighting style, the signal line attached to the specified port is highlighted in red.

Open the example. Then, open the slexAircraftExample model.

open_system('slexAircraftExample')

Get the handle of the Inport block of the Subsystem block named Vertical Gust wGust, ft/sec.

h=Simulink.findBlocks('slexAircraftExample/Aircraft Dynamics Model','name','Vertical Gust wGust (ft/sec)');

Highlight the port.

hilite_system(h)

The Aircraft Dynamics Model subsystem opens and shows the Inport block named Vertical Gust wGust, ft/sec.

When you use the default highlighting style, the port block and the Subsystem block that contains the port block highlight with a red outline and a yellow fill.

Open the example. Then, open the slexAircraftExample model.

open_system('slexAircraftExample')

Get the handle of the annotation at the top of the slexAircraftExample model.

h=find_system('slexAircraftExample','FindAll','on','type','annotation','name','Aircraft Longitudinal Flight Control');

Highlight the annotation.

hilite_system(h)

When you use the default highlighting style, the annotation is highlighted as red text with a yellow fill.

Open the example. Then, open the vdp model.

open_system('vdp')

Highlight the masked subsystem block named Mu.

hilite_system('vdp/Mu')

To remove the highlighting from the masked subsystem block named Mu, specify the highlighting style as 'none'.

hilite_system('vdp/Mu','none')

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

Specify Highlighting Style for Block

Open the example. Then, open the vdp model.

open_system('vdp')

Highlight the masked Subsystem block named Mu block using the style 'fade'.

hilite_system('vdp/Mu','fade')

Specify Highlighting Style for Signal Line

Get the handle of the signal line named x1.

h=find_system('vdp','FindAll','on','type','line','name','x1');

Highlight the signal line named x1 using the style 'fade'.

hilite_system(h,'fade')

You can customize a highlighting style by setting 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'

Now, you can customize the debug highlighting style.

Open the example. Then, open the f14 model.

open_system('f14')

Customize the highlighting style 'debug'.

set_param(0,'HiliteAncestorsData',struct('HiliteType','debug','ForegroundColor','darkBlue','BackgroundColor','lightBlue'));

Use the 'debug' highlighting style to highlight a block.

hilite_system('f14/Controller/Alpha-sensor Low-pass Filter','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

Block, port, line, or annotation to highlight, specified as:

  • The full block path name

  • A Simulink.BlockPath object

  • A numeric handle for lines, ports, or annotations

  • Simulink identifier

  • A traceability tag from the comments of Simulink Coder generated code.

    Using a traceability tag requires a Simulink Coder license.

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

  • Root

  • A unique model number assigned by Simulink during code generation

Example: 'vdp/Mu', 'sldemo_fuelsys/fuel_rate_control/airflow_calc', 'vdp:3', '<Root>/Mu'

Highlighting style, specified as one of these values. You can customize the appearance of any of the styles. See Customize Highlighting 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'

Version History

Introduced before R2006a

See Also

(Embedded Coder) |