How to check if Constant and Gain blocks are too small

조회 수: 3 (최근 30일)
Matteo
Matteo 2024년 12월 4일
댓글: Matteo 2024년 12월 11일
How can I write a script to identify all Constant and Gain blocks in a Simulink model that are too small to fully display their values?
Currently, I compare the actual block size (obtained via
get_param(block, 'Position')
) with an estimated required size. This estimation is based on the length of the Value parameter multiplied by an assumed pixel width per character. However, this approach leads to inaccuracies, especially for blocks that are borderline too small.
Is there a more robust or straightforward method to determine if the block size is adequate?
  댓글 수: 2
Andreas Goser
Andreas Goser 2024년 12월 5일
While I probably would do a similar approach than you, I wonder what the underlying reason could be for this happening in the first place.
Matteo
Matteo 2024년 12월 11일
The issue arises from the inaccuracy of the current method. When setting the required height and width to a specific estimation, I encounter corner cases where, for example, the Gain blocks are on the verge of being unreadable but aren't quite there yet. However, the code returns a failure, incorrectly indicating that the block is already unreadable. This happens because the estimations are not accurate enough. I'm looking for a better way to solve this.

댓글을 달려면 로그인하십시오.

답변 (1개)

Oliver Jaehrig
Oliver Jaehrig 2024년 12월 6일
There is currently no documented way to do this in a more robust way. I agree with @Andreas Goser that it might be good to better understand the root cause.
If you can use undocumented features, please contact our Technical Support team via an official case and let us know your use case and we can check if we can send you a better way to do that.
Also please share the full use case with us (if you want to code a Model Advisor check for example).

카테고리

Help CenterFile Exchange에서 Array and Matrix Mathematics에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by