How can I set up an automatically background color to blocks in Simulink?

8 ビュー (過去 30 日間)
Mike Visser
Mike Visser 2022 年 3 月 2 日
コメント済み: Mike Visser 2022 年 3 月 2 日
Hi! I am an Automotive Engineering student and I am wondering if it is possible to let Simulink automatically use certain background colors for blocks?
I have been reading multiple "solutions" for this, for example this one:
It works but it works partly, since it doesn't work for me for inputs, subsystems, 1D look up tables. I have tried to work with the find_system and set_param statements but I don't really understand the find_system. I used the following code:
simulation_name;
Model='simulation_name';
Constant=find_system(Model,'FindAll','On','BlockType','Constant');
set(Constant,'BackgroundColor','green');
Subsystem=find_system(Model,'FindAll','On','BlockType','Subsystem');
set(Subsystem,'BackgroundColor','yellow');
And I tried to switch between all sorts of blocks but nothing I tried worked. So then I was wondering if it is possible to acces the library with the preferences where you could change the font, text size and maybe also color? If anyone has an other idea I would love to hear it as I am a bit tired of putting in every color manually.
Best regards,
Mike
  6 件のコメント
Fangjun Jiang
Fangjun Jiang 2022 年 3 月 2 日
Do it manually first. Select a block in the model, run "get(gcbh,'BlockType')" in MATLAB.
Mike Visser
Mike Visser 2022 年 3 月 2 日
Thank you very much for your help! I can get it working from here! Awesome

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeSchedule Model Components についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by