Change Simscape solid color during runtime

3 ビュー (過去 30 日間)
Mark
Mark 2020 年 6 月 12 日
回答済み: Steve Miller 2021 年 6 月 5 日
Hi all,
As the title says, during a Simscape run I want to change the color of some solids.
In my case I have a Brick solid I want to color red if it's position goes past a particular point.
I can set the inital color in the Brick solid Properties->Graphic->Visual Properties->Color, and haved used variables in place of values in that field. I also changed the option from Compile-time to Run-time.
I can write to the workspace variable and change color between runs this way but not update the color during the run.
Any suggestions appreciated. Thanks
  1 件のコメント
Ameer Hamza
Ameer Hamza 2020 年 6 月 13 日
A while ago, I tried doing something similar using event listeners, but simscape blocks are not like normal Simulink blocks. I guess their visualization cannot be updated during runtime.

サインインしてコメントする。

回答 (1 件)

Steve Miller
Steve Miller 2021 年 6 月 5 日
Through MATLAB release R2021a, you cannot cannot change the color of a solid based on an input signal. What you can do, though, is put another solid just behind it that has the new color, and then when you want the color to change move that solid in front of the other solid.
In the video in this LinkedIn post, we used a set of solids to have the battery color change gradually as it heats up:
--Steve

カテゴリ

Help Center および File ExchangeRun-Time Parameters についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by