Main Content

setVariables

Set variables in data source workspace

Since R2022b

    Description

    setVariables(dsWks,varNames,varValues) assigns the values varValues to the variables varNames in the data source workspace represented by the Simulink.data.DataSourceWorkspace object dsWks.

    example

    Examples

    collapse all

    Specify values for multiple variables in a DataSourceWorkspace object.

    setVariables(sourceWorkspace,["c" "d"],{3,4})

    Input Arguments

    collapse all

    Data source workspace, specified as a Simulink.data.DataSourceWorkspace object.

    Variable names, specified as a string array or cell array of character vectors.

    Example: ["c" "d"]

    Example: {'e', 'f'}

    Variable values, specified as a cell array of scalars. The dimensions of the cell array must match the dimensions of varNames.

    Example: {3,4}

    Version History

    Introduced in R2022b