MATLAB: Set simulation time and fixed step size for a Simulink model from the command line

command linesimulation timesimulinkstep size

Hi! I have a simulink model that I need to simulate over a few different durations and with a fixed (but different) sampling time. So what I want to do is to set this from the command line without having to start up simulink and change it manually each time.
To clarify I want to set the simulation duration (or the start time/stop time) and the solver options to Fixed-step (or at least change the step-size). So it would look something like this in a script/the command line:
sim('simModel', 'simulationTime', [0 10], 'solverOptions.stepSize', 1/1024)
Where 'simModel' is the simulink model in question.
It doesn't have to look like this, but just to give you an idea of what I want to do. Is there a way to do this?
I can't really find it in the documentations, the only thing I find is how to set the sampling time for a specific block, but I want to keep those as inherited.

Best Answer

If you open the model's Configuration Parameters, for each parameter you can right-click and select "What's This?". This will open up some documentation, which includes a table that shows you how to programmatically use that parameter.
So, you can take that and use it in the sim command as you specified:
>> sim('modelName','StartTime','0','StopTime','10','FixedStep','0.2');
Notice that the properties have to take a string value and not a numeric value. This is where the num2str function comes in handy. For example,
for Ts = 0.01:0.01:0.1
simout = sim('modelName','FixedStep',num2str(Ts));
end
- Sebastian