How can I change the annotations of a block in Simulink Simscape to reflect the value of the parameter?

조회 수: 7 (최근 30일)
Hello,
I was wondering how can I show the value of my resistor in the following situation.
I have the following resistor called Rs_EC=10 whose value is stored in workspace variable 1/Soil.Gsoilmax (let's say 10,) I have assiged the R value of such resistor to 1/Soil.Gsoilmax in the block itself, and now I would like to see that value on my simulink model, in other words, the 1/Soil.Gsoilmax show in the below photo should be 10.
How can I achieve this?
Thanks in advance!
Untitled.png

답변 (1개)

Rajanya
Rajanya 2025년 2월 11일 11:57
You can use a block's 'AttributesFormatString' parameter to display the specified block parameter values below the block - Specify Block Properties.
Following the same, the value 10 was added below the sample resistor block that I used -
set_param(gcb,'AttributesFormatString',sprintf('%s',num2str(expr))) % expr evaluates to 10
Hope this answers your question.
Thanks!

카테고리

Help CenterFile Exchange에서 General Applications에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by