MATLAB Answers


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

Asked by Pramit Biswas on 2 Apr 2018
Latest activity Commented on by Birdman
on 3 Apr 2018
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?


Have you checked my answer?
Yes, sorry to say that will not serve the purpose. Musking is very helpful for setting subsystem values from main block. What I require somewhat different. I have multiple blocks of same thing in different location. And I want to change their parameter in one single go. In case if it was coding, I would have used function to reduce repeatability. Thanks for assisting though.
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.

Sign in to comment.



1 Answer

Answer by Birdman
on 2 Apr 2018

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.


Sign in to comment.