Simulink sample time colors in 2025b

43 ビュー (過去 30 日間)
Alex Aronov
Alex Aronov 2025 年 11 月 10 日 19:32
回答済み: Alex Aronov 2025 年 11 月 13 日 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

回答 (2 件)

Leepakshi
Leepakshi 2025 年 11 月 13 日 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 2025 年 11 月 13 日 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

カテゴリ

Help Center および File ExchangeSimulink についてさらに検索

製品


リリース

R2025b

Community Treasure Hunt

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

Start Hunting!

Translated by