MATLAB: How to pass a parameter structure from m-file to Simulink

matlab-simulink interfacepass parameterssimulinkstructures

Hello there,
I set up a model in Simulink I would like to pass parameters to. The parameters are
to be defined in an m-file. Passing single parameters from Matlab to Simulink is no
problem, but I have not yet managed to figure out how to pass parameters collected in
a structure from Matlab to Simulink.
E.g., my m-File to call my Simulink model with would look something like this:
function callMySimulinkModel
ParamsToPassToSimulink.Param1 = 10;
ParamsToPassToSimulink.Param2 = 5;
....
...
.
ParamsToPassToSimulink.ParamsN = 10;
sim('myModel', [0 10.0]);
where to add what command in order to pass the
ParamsToPassToSimulink-Structure to Simulink in this
function/script ???
end
I've searched the internet for some time and found nothing but some advice on how to do it in previous Matlab releases:
Unfortunately, this does not seem applicable anymore. I also tried the shared workspace command – without success so far.
Does anybody know a solution to this?
Thanks in advance! Marius

Best Answer

Hello Ilham - thanks for your reply!
Using a script works as well, but does not (as it seems to me) change the problem.