Main Content

uisimvartuner

Create a model variable tuner UI component in an app

Since R2024a

    Description

    example

    tun = uisimvartuner creates a variable tuner UI component in a new figure.

    tun = uisimvartuner(parent) creates a variable tuner UI component in the specified parent container. The parent container can be a figure created using the uifigure function or one of its child containers.

    tun = uisimvartuner(___Name,Value) specifies VariableTuner properties using one or more name-value arguments. Use this option with any of the input argument combinations in the previous syntaxes.

    Examples

    collapse all

    Create a variable tuner UI component in a panel.

    fig = uifigure('Name','myFigure');
    panel = uipanel(fig)
    tun  = uisimvartuner(panel)

    Create a variable tuner in a UI figure, and then specify a Simulation object for the variable tuner.

    Create a UI figure window containing a variable tuner and a panel.

    fig = uifigure('Name','myFigure');
    panel = uipanel(fig)
    tun = uisimvartuner(panel)

    Specify a Simulation object to use the variable tuner button with a model. Editing the variable values in the variable tuner updates the variables in the simulation.

    runSim = simulation('mdlName')
    tun.Simulation = runSim;

    Create a variable UI component in a UI figure, and specify a list of variables to display in the variable tuner UI component.

    Create a UI figure window containing a variable tuner and a panel.

    fig = uifigure('Name','myFigure');
    panel = uipanel(fig)
    tun = uisimvartuner(panel)

    Specify a list of variables to display in the variable tuner UI component with the VariablesFilter property

     tun.VariablesFilter = {'x', 'y', 'z'}

    Input Arguments

    collapse all

    Parent container, specified as a Figure object created using the uifigure function or one of its child containers, such as a Tab, Panel, or GridLayout object. If you do not specify a parent container, MATLAB® calls the uifigure function to create a new Figure object that serves as the parent container.

    Name-Value Arguments

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example: uisimvartuner(VariablesFilter={'x','y','z'})

    Note

    The properties listed here are a subset of the available properties. For the full list, see VariableTuner Properties.

    Filter to display variables in the variable tuner UI component, specified as a cell array.

    Example: uisimvartuner(VariablesFilter={'x','y','z'})

    State of live variable tuning, specified as 'on' or 'off', or as numeric or logical 1 (true) or 0 (false). A value of 'on' is equivalent to true, and 'off' is equivalent to false. Thus, you can use the value of this property as a logical value. The value is stored as an on/off logical value of type matlab.lang.OnOffSwitchState.

    • If you set this property to 'on', the app user can tune the variables as the simulation is progressing.

    • If you set this property to 'off', the app user cannot tune the variables as the simulation progresses.

    Simulation representation that provides an interface to control the simulation of a Simulink® model, specified as a Simulation object.

    Tips

    • uisimvartuner component supports the following value types:

      • single

      • double

      • uint8, uint 16, uint32, uint64

      • int8, int32, int64

      • logical

      • matlab.lang

      • OnOffSwitchState

      • string

      • char

      • struct

    • Values for uisimvartuner must be scalar or of 2 dimensional type.

    Version History

    Introduced in R2024a