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

30 次查看(过去 30 天)
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.

采纳的回答

MathWorks Support Team
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Interactive Model Editing 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by