Main Content

uisimdatabutton

R2026b

Create buttons to save or load simulation data in app

Since R2024a

    Description

    simdatabtn = uisimdatabutton creates a button that saves simulation output data and returns the SaveOutputButton object. MATLAB® calls the uifigure function to create a new figure to serve as the parent container.

    simdatabtn = uisimdatabutton(p) creates the button in the specified parent container. The parent can be a Figure object or one of its child containers.

    simdatabtn = uisimdatabutton(___,btntype) creates a button of the specified type. The button type determines whether the button saves simulation output data or loads simulation input data.

    simdatabtn = uisimdatabutton(___,Name=Value) creates a button with properties specified by one or more name-value arguments.

    example

    Examples

    collapse all

    Add a data button component to an app. Then, connect the button to a Simulation object.

    f = uifigure;
    outbtn = uisimdatabutton(f,Text="Save Output Data");

    To connect the button to a simulation, specify the Simulation property. When you click the button, the app saves outputs from the specified simulation.

    mdl = "MyModel";
    sm = simulation(mdl);
    outbtn.Simulation = sm;

    Add a data button component to an app. Then, connect the button to a Simulation object.

    Create a new figure. Then, add a data button. To configure the button to load external input data, specify the button type as loadinput.

    f = uifigure;
    inbtn = uisimdatabutton(f,"loadinput");

    To connect the button to a simulation, specify the Simulation property. When you click the button, the app loads inputs for the specified simulation.

    mdl = "MyModel";
    sm = simulation(mdl);
    inbtn.Simulation = sm;

    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.

    Simulation data button style, specified as "saveoutput" or "loadinput".

    • "saveoutput" — Creates a button to save simulation output data, labeled Save Simulation Output

    • "loadinput" — Creates a button to load external input data for top-level input ports, labeled Load Input

    Name-Value Arguments

    collapse all

    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: uisimdatabutton("loadinput",Text="Load Input Data")

    Note

    This section lists a subset of the available properties. For the full list, see SaveOutputButton Properties and LoadInputButton Properties.

    Button icon SVG file, specified as a string or a character vector.

    Button label, specified as a string or a character vector.

    Filename for saved simulation outputs, specified as a string or a character vector.

    The OutputFileName property is available only for simulation data button UI components that save simulation outputs.

    Simulation for which to load or save data, specified as a Simulation object.

    Version History

    Introduced in R2024a