Main Content

Simulink.SimulationData.DatasetRef.getDatasetVariableNames

List names of variables in MAT file that contain Simulink.SimulationData.Dataset objects

    Description

    example

    dsNames = Simulink.SimulationData.DatasetRef.getDatasetVariableNames(filename) returns the names of variables in the MAT file filename that contain Simulink.SimulationData.Dataset objects.

    When you want to get the names of variables that contain Dataset objects, the Simulink.SimulationData.DatasetRef.getDatasetVariableNames function runs faster than the who or whos functions.

    Using the name of the MAT file and the name of a variable that contains a Dataset object, you can create a Simulink.SimulationData.DatasetRef object that references the data in the MAT file without loading the entire Dataset object into memory.

    Examples

    collapse all

    When your simulation input data is stored as a Simulink.SimulationData.Dataset object in a file that is too large to load into memory, you can create a Simulink.SimulationData.DatasetRef object to stream input data into your model during simulation. The DatasetRef object references the data in the Dataset object in the file and incrementally loads the data during simulation.

    To create a DatasetRef object, you need the name of the file and the name of the variable in the file that contains the Dataset object. You can use the Simulink.SimulationData.DatasetRef.getDatasetVariableNames function to see the names of all variables in a file that contain Dataset objects without loading the file into memory.

    Get the names of variables in the file aircraftData.mat that contain Dataset objects.

    datasetNames = Simulink.SimulationData.DatasetRef.getDatasetVariableNames("aircraftData.mat")
    datasetNames = 1x3 cell
        {'logsout'}    {'xout'}    {'yout'}
    
    

    Create a reference to the data in the Dataset object logsout.

    logsoutDSR = Simulink.SimulationData.DatasetRef("aircraftData.mat","logsout");

    To stream the data stored in the Dataset object logsout as input for simulation, specify the value for the Input parameter as logsoutDSR. Loading data from a DatasetRef object works the same as loading data from a Dataset object except that the data is incrementally loaded into memory.

    Input Arguments

    collapse all

    Name of MAT file, specified as a string or a character vector.

    Example: "myMATFile.mat"

    Data Types: char | string

    Output Arguments

    collapse all

    Names of variables that contain Dataset objects, returned as a cell array of character vectors.

    Version History

    Introduced in R2016a