How can I change the colors of the plots displayed by the Scope block in Simulink?

31 views (last 30 days)
I would like to have an automatic way in which I can change the color of the plots that I see in all my Simulink Scope blocks.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 23 Jul 2009
In order to change the colors of the plots displayed by Simulink Scope blocks, you can modify the "ColorOrder" property of the axes that displays the data. To do this, you need to obtain the handle to the axes, which can only be done after turning on the "ShowHiddenHandles" property of the MATLAB root object. Here is an example that changes the colors for all Scope blocks in a particular model:
scopes = find_system(gcs,'blocktype','Scope')
shh = get(0,'ShowHiddenHandles');
set(0,'ShowHiddenHandles','On');
for i = 1:length(scopes)
set_param (scopes{i},'open','on');
a = findobj (gcf,'type','axes')
set (a,'ColorOrder',[1 0 0;0 1 0;0 0 1;0 1 1]);
end
set(0,'ShowHiddenHandles',shh);
NOTE: Simulink does not support manipulating graphics properties using the Scope or Signal Viewer handle. When manipulating any graphics properties, do not change or alter the structure of the scope. For example, you should not delete any of the graphical objects (text, axes, menus, etc) in the scope as this could lead to unstable behavior.

More Answers (0)

Categories

Find more on Programmatic 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!