Simulink sample time colors in 2025b

42 views (last 30 days)
Alex Aronov
Alex Aronov on 10 Nov 2025 at 19:32
Answered: Alex Aronov on 13 Nov 2025 at 18:13
I need to transfer a 2023a Simulink design to 2025b version. Everything goes well except the sample time colors. I have 8 colors in 2023a design and they are completely screwed up in 2025b version.
2025b supports on;y 3 colors by default. I ran a script that setup 8 colors in 2025b. However, during conversion from 2023a to 2025b, new colors are still srewed up.
My question is: what do I need to do to make sample rate colors in 2025b Simulink look the same as in 2023a design?
Thank you,
alex

Answers (2)

Leepakshi
Leepakshi on 13 Nov 2025 at 14:38
Hi Alex,
Starting in MATLAB R2023b, you can programmatically view and customize Simulink’s sample time colors using the "Simulink.SampleTimeColors.Palette" class. This allows you to get the current color palette, set a new palette with your preferred color order and number of colors, and reset to the default palette—all via simple MATLAB commands. For example, you can use "Simulink.SampleTimeColors.Palette.getActive" to view the current colors, and "Simulink.SampleTimeColors.Palette.setActive" to apply a custom palette, making it much easier to manage and migrate sample time color settings across Simulink versions.
Refer to below documentation for methods possible under sampletimecolors:
Thanks

Alex Aronov
Alex Aronov on 13 Nov 2025 at 18:13
Thank you for the answer, Leepakshi!
By now, I was able to figure out how to create a script that updates the Sample time colors in 2025b to look the same as in 2023a model.
However, what is still not working is the port names color.
In 2023a Simulink model all port names have the same color as the corresponding sample rate color for the port signal.
After this model upgraded to 2025b version many ports do not follow this rule. They may take color that corespond to a different sample time rate or simply take black color, which does not correspond to any sample time rate.
My client realy wants to keep the rule that makes all port names to be same color as the corresponding sample time rate color.
Can you help me with that?
Thank you,
alex

Categories

Find more on Simulink in Help Center and File Exchange

Products


Release

R2025b

Community Treasure Hunt

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

Start Hunting!