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

8 views (last 30 days)
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!

Answers (1)

Sebastian Castro
Sebastian Castro on 29 Apr 2015
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 Comments
Medha Parulekar
Medha Parulekar on 29 Apr 2015
I have tried to do this..but i am running in external mode where i am having some issues
Sebastian Castro
Sebastian Castro on 29 Apr 2015
What kind of issues? Do you have an error message, or does the block color simply not change?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!