Main Content

who

Get names of editable properties on Simulink.SimulationOutput object

    Description

    who(simOut) lists the names of user-added properties and properties that contain logged data on the Simulink.SimulationOutput object simOut.

    example

    props = who(simOut) returns a cell array of character vectors that contains the names of user-added properties and properties that contain logged data on the Simulink.SimulationOutput object simOut.

    Examples

    collapse all

    A Simulink.SimulationOutput object contains all data logged from simulation as well as simulation metadata and error messages that occur during simulation. You can use the who function to list properties on a Simulink.SimulationOutput object created by logging data from simulation or by a user.

    Open the model LoggingBlocks, which uses multiple blocks and signal logging to log simulation data.

    mdl = "LoggingBlocks";
    open_system(mdl);

    Create a Simulink.SimulationInput object to configure a simulation that runs to a stop time of 20.

    simIn = Simulink.SimulationInput(mdl);
    simIn = setModelParameter(simIn,"StopTime","20");

    Simulate the model.

    simOut = sim(simIn);

    Use the who function to inspect the contents of the simulation results.

    dataLogs = who(simOut)
    dataLogs = 5x1 cell
        {'logsout'  }
        {'recordout'}
        {'simout'   }
        {'tout'     }
        {'yout'     }
    
    

    Use the get function to access the data for the variable simout.

    simout = get(simOut,dataLogs{3})
      timeseries
    
      Common Properties:
                Name: 'Big Sine'
                Time: [51x1 double]
            TimeInfo: tsdata.timemetadata
                Data: [51x1 double]
            DataInfo: tsdata.datametadata
    

    Input Arguments

    collapse all

    Simulation results, specified as a Simulink.SimulationOutput object.

    Output Arguments

    collapse all

    Names of user-added properties and properties that contain logged data, returned as a cell array of character vectors.

    Version History

    Introduced in R2009b