How do I change a common property of multiple blocks selected with a mouse in a Simulink model?

22 views (last 30 days)
I have a model and I have selected multiple blocks with a mouse. I want to change the background color of all these blocks. How do I do this? GCB function returns only the handle to one block.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
The 'Selected' property of a block provides information on the status of whether or not the block is selected. The following code can be used to change the background color of the selected blocks:
% Select blocks in a model
a = find_system(gcs,'Selected','on');
% Change the background color of each selected block
for i = 1 : length(a)
set_param(a{i},'BackgroundColor','red')
end

More Answers (0)

Categories

Find more on Interactive Model Editing in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!