![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1825782/image.png)
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](https://www.mathworks.com/matlabcentral/answers/uploaded_files/210688/Untitled.png)
댓글 수: 0
답변 (1개)
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1825782/image.png)
Hope this answers your question.
Thanks!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 General Applications에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!