フィルターのクリア

Removing all highlightning programmatically

17 ビュー (過去 30 日間)
Benjamin
Benjamin 2016 年 11 月 2 日
コメント済み: Prabhakar Vallury 2023 年 2 月 1 日
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.
Thanks,

採用された回答

Swarooph
Swarooph 2016 年 11 月 4 日
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')

その他の回答 (2 件)

dzid_
dzid_ 2019 年 7 月 22 日
編集済み: dzid_ 2019 年 7 月 22 日
This is better - the same as right-click -> Remove Highlighting
SLStudio.Utils.RemoveHighlighting(get_param(bdroot,'handle'))
  2 件のコメント
Zach Haveraneck
Zach Haveraneck 2021 年 9 月 29 日
Thank you this works very well. It shut off all the highlighting. I was finding that the hilite_system(hilited_blocks,'off')
method was leaving signal lines highlighted at best.
This method is perfect for removing all highlighting.
Prabhakar Vallury
Prabhakar Vallury 2023 年 2 月 1 日
Does something simple like this also exist for "selected" handles? It would be nice to turn off the Selected parameter at the bdroot level without having to loop over each block. TIA

サインインしてコメントする。


Benjamin Paul
Benjamin Paul 2019 年 7 月 23 日
This function didn t exist back in 2016 so thanks for the update, tried and seems to work fine
  1 件のコメント
dzid_
dzid_ 2019 年 7 月 23 日
It's actually in MATLAB 2016a. For what it's worth, the function says:
% Copyright 2014 The MathWorks, Inc.
Glad it works.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSimulink Functions についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by