Reputation: 2939
I have created a subsystem in Simulink. I would like this subsystem to have a single parameter, which is supposed to be a Matlab structure. Inside the subsystem, I would then like parameters of some of the blocks to be the fields of this structure.
So for example, imagine the subsystem has a single parmeter sys_inputs
, then inside the subsystem I have two Constant blocks and the value for the first Constant block should be sys_inputs.Constant1
, and the other should be sys_inputs.Constant2
.
Is this possible, and if so, how exactly?
I'm finding the Matlab documentation on passing mask parameters to subsystem internal blocks a bit obtuse.
The purpose is so that the user only has to provide a single parameter to the subsystem instead of changing many parameters, when this input usually comes pre-packaged as a structure.
Upvotes: 0
Views: 2753
Reputation: 2939
I discovered the answer myself.
First create the subsystem
Right click and 'create mask'
Edit mask parameters
Add an 'edit' parameter. The 'Name' of this parameter will be the variable name you can use inside your subsystem, e.g. sys_inputs
Inside the subsystem, you can use the sys_inputs
parameter as though it was a workspace variable, so you can enter things like sys_inputs.Constant1
in the subsystem components parameters
Upvotes: -1