Removing all highlightning programmatically

R
rihan · Oct 21, 2021 · 2K views
Question
Hello,   I am creating/deleting programmatically some simulink functions recursively, and for debug purpose, I hilghlight blocks I'm currently working on with the hilite_system function, for example: hilite_system(gcbh) I know I can remove the highlighting of a specific block by doing: hilite_system(gcbh,'none') But I don't manage to remove all the highlighting at once.   My question is, is there a simple way to do a global "Remove Highlighting" just like Simulink does (without specifying some blocks), or do I have to make a loop and force all my blocks to none one after another? It would work, but it feels like crushing a fly with a cannon.   I found the function remove_hilite.p but I don't manage to do what I intend with some random arguments.
Expert Answer
Profile picture of Neeta Dsouza
Neeta Dsouza PhD Expert
Answered Aug 19, 2026
There is no single function that can do this. You will need to use a collection of find_system and hilite_system to do this. Example below.

% Get highlighted blocks. Idea is to look for all blocks with yellow background (default highlight color). 
% This results in a cell array of paths to all blocks that satisfy this condition.
% Note that if your highlight color is different or more than one color, you would need to run an 
% appropriate or multiple commands to get the list of all blocks highlighted no matter what color.

hilited_blocks =  find_system('my_model','BackgroundColor','yellow')

% Pass block list to hilite_system to switch 'off' color.
hilite_system(hilited_blocks,'off')
100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!