I am using the Simulink.SimulationInput class to define simulation parameters for multiple simulations. I am using the following lines of code: simIn = Simulink.SimulationInput(model); simIn.setModelParameter('SaveTime','on','TimeSaveName','tout'); simIn.setModelParameter('SaveState','on','StateSaveName','xout'); simIn.setModelParameter('SaveOutput','on','OutputSaveName','yout'); simIn.setBlockParameter('model/Proportional Gain', 'Value', '-9.4'); simOut = sim(simIn); I can tell that none of these parameters are changed when I simulate the model. I expect that the gain value of -9.4 will cause the system to become unstable. However, the plot of the system response is exactly the same as that of the default model. What step am I missing to be able to use the 'SimulationInput' object for running multiple simulations?
Neeta Dsouza answered .
2025-11-20
simIn = Simulink.SimulationInput(model);
simIn = simIn.setModelParameter('SaveTime','on','TimeSaveName','tout');
simIn = simIn.setModelParameter('SaveState','on','StateSaveName','xout');
simIn = simIn.setModelParameter('SaveOutput','on','OutputSaveName','yout');
simIn = simIn.setBlockParameter('model/Proportional Gain', 'Value', '-9.4');
simOut = sim(simIn);