How can you change the color of a block based on the input value?

12 次查看(过去 30 天)
I am trying to get the 'Display' block color in Simulink. Based on the input value, if it is within a certain range, I want the color to change to indicate the change to the user beyond just the number reading. How can I do so? Thanks!

回答(1 个)

Sebastian Castro
Sebastian Castro 2015-4-29
The first thing I could think of was creating a MATLAB Function block that checks the signal incoming to the block. In this block, you can use the following command to change your block colors:
set_param('modelName/blockName','BackgroundColor','red');
I've attached a screenshot:
- Sebastian
  2 个评论
Medha Parulekar
Medha Parulekar 2015-4-29
I have tried to do this..but i am running in external mode where i am having some issues
Sebastian Castro
Sebastian Castro 2015-4-29
What kind of issues? Do you have an error message, or does the block color simply not change?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Sources 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by