I managed to solve this by adding the parameter programmatically.
Initially, I had a structure containing Simulink Parameters, that I would like to use as Model Instant Parameter:
ctrl1_struct =
struct with fields:
tholdoff: [1×1 Simulink.Parameter]
vdc2: [1×1 struct]
demagPeriod: [1×1 Simulink.Parameter]
itr2min: [1×1 struct]
But this does not work. You can add it to the model workspace but not use it as argument.
The solution is to convert it into a Simulink Parameter, which has the structure as value:
ctrl1 = Simulink.Parameter(ctrl1_struct)
ctrl1 =
Parameter with properties:
Value: [1×1 struct]
CoderInfo: [1×1 Simulink.CoderInfo]
Description: ''
DataType: 'struct'
Min: []
Max: []
Unit: ''
Complexity: 'real'
Dimensions: [1 1]
Then you can add it to the workspace:
myModelWorkspace = get_param('app_dcdc_prio1Ctrl','ModelWorkspace');
assignin(myModelWorkspace, 'ctrl1', ctrl1);
Now it is usable as argument and thus as model instance parameter.