![](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 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Rajanya
on 11 Feb 2025 at 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 Comments
See Also
Categories
Find more on General Applications in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!