主要内容

Simulink.Solver.register

R2026b

Register plugin solver for Simulink simulation

Since R2026b

    Description

    Simulink.Solver.register(slvr) registers the plugin solver slvr for use in Simulink® simulations. To use the solver, specify the Type and Solver configuration parameters of the simulated system.

    Registering a plugin solver makes the solver available in the current MATLAB® session for all models. The software automatically unregisters plugin solvers when you close MATLAB.

    The software automatically registers a plugin solver if you open a model in which the Solver parameter specifies a plugin solver and the solver class definition is on the MATLAB path.

    example

    Examples

    collapse all

    Suppose you want to simulate a model named MyModel using a fixed-step plugin solver named MySolver. Register the solver. Then, configure the model to use the plugin solver and simulate the model.

    slvr = "MySolver";
    mdl = "MyModel";
    Simulink.Solver.register("MySolver")
    set_param(mdl,SolverType="Fixed-step")
    set_param(mdl,Solver="MySolver")
    out = sim(mdl);

    Input Arguments

    collapse all

    Name of plugin solver, specified as a string or a character vector.

    Data Types: char | string

    Version History

    Introduced in R2026b