Specify any block parameter values from other constant block (simulink)

1 ビュー (過去 30 日間)
Pramit Biswas
Pramit Biswas 2018 年 4 月 2 日
コメント済み: Ege Can Koçak 2021 年 6 月 3 日
I have multiple RLC blocks, and I want to control their parameter from one single block, so that I don't have to set for each RLC block.
What worked: Named a workspace variable as L1 with the desired value and as shown in RLC-block parameter it fetched the value easily.
What I'm trying: Remove the dependency of workspace variable. Hence, created one constant block. Named the block as L1 and called it in RLC-block. But, it is not working.
Is it possible? If yes, how?
update 1: using str2num(get_param('modelName/L1','Value')) works, but is there any other/efficient way to do it?
  5 件のコメント
Birdman 2018 年 4 月 3 日
I have multiple blocks of same thing in different location
Ok, then why don't you gather them within one subsystem? Will it be challenging? You can set inports and outports accordingly to that from subsystem and will not change the hierarchy of your model.


回答 (1 件)

Birdman 2018 年 4 月 2 日
The easiest overcome to this problem is using Masking in Simulink. Take all RLC blocks within the same subsystem and right click on your subsystem and go to Mask->Create Mask(or the shortcut with Ctrl+M), create a simple mask with the number of parameters you want to change in your model. I attach a model with simple mask. When you double click the subsystem, it immediately opens the parameter window where you can enter your parameter and simply hit Apply button. In the simulation, you will see immediate change.
  1 件のコメント
Ege Can Koçak
Ege Can Koçak 2021 年 6 月 3 日
Hello, I am actually doing same thing for a different application. I have lots of constant block to run the simulation, I wanted to make them more useful so I masked but I cannot change the values of the constant with mask, everthing works fine but the valus does not change. I tried to do promote them but still its not working. Any suggestion for me ?



Find more on Subsystems 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!

Translated by