Skip to content

Instantly share code, notes, and snippets.

@summivox
Last active November 5, 2015 17:27
Show Gist options
  • Select an option

  • Save summivox/327e0d2e51174b5895e9 to your computer and use it in GitHub Desktop.

Select an option

Save summivox/327e0d2e51174b5895e9 to your computer and use it in GitHub Desktop.
Simulink Realtime: common conf + solver override
function slrt_conf_init(conf, solver, Ts)
% initialize configuration of current model with default, then override
% with given solver and timestep setting
%
% conf: path to common configuration file
% solver: 'FixedStepDiscrete', 'ode8', 'ode4', ...
% Ts: fixed step time of solver
%
% NOTE: SLRT allows only fixed-step solvers
Simulink.BlockDiagram.loadActiveConfigSet(gcs, conf);
set_param(gcs ...
, 'SolverType', 'Fixed-step' ...
, 'Solver', solver ...
, 'FixedStep', num2str(Ts, '%.6e') ...
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment