Main Content

loadScenarioToWorkspace

Load scenario to base workspace

Since R2024b

    Description

    loadScenarioToWorkspace(filename,variable) loads a scenario of the specified file filename to the MATLAB® base workspace, assigns the variable variable to it, and verifies that filename is a supported file type.

    loadScenarioToWorkspace(filename,variable,spreadsheetDataTypeConfig) loads a scenario and casts spreadsheet data according to the spreadsheet type configuration specified by spreadsheetDataTypeConfig.

    loadScenarioToWorkspace(filename,variable,spreadsheetDataTypeConfig,filetype) loads a scenario and uses filetype to read the data to assign a variable to workspace.

    example

    Examples

    collapse all

    Verify that the variable var1 is loaded in the MATLAB® base workspace for the scenario file MatlabTimeSeries.mat using the loadScenarioToWorkspace function.

    loadScenarioToWorkspace('ThreeMatlabTimeSeries.mat','var1')
    The supported file type is Simulink.io.MatFile
    

    Input Arguments

    collapse all

    File name for scenario in a supported file type, such as .mat, .xls, .xlsx, or a registered file type, specified as a character vector or string.

    Example: 'MatlabTimeSeries.mat'

    Data Types: char | string

    Variable name to be loaded saved in filename, specified as a character vector

    Example: 'var1'

    Data Types: char | string

    Spreadsheet type configuration, specified as a character vector or string. To cast the spreadsheet signal data to this configuration, first create a data cast configuration.

    Example: spreadsheetDataTypeConfig(1).DataType = {'logical'}; spreadsheetDataTypeConfig(1).Signals = {{1}}

    Data Types: char | string

    File type of filename, specified as a character vector or string. To cast the spreadsheet signal data to this configuration, first create a data cast configuration.

    Example: 'var1'

    Data Types: char | string

    Version History

    Introduced in R2024b