Main Content

clear

Remove specified variables from connected data source

Since R2024a

    Description

    clear(connectionObj,varNames) removes the specified variables varNames from the connected data source connectionObj. The function does not return an error if the variable does not exist.

    If the data connection can access multiple definitions of the same variable (for example, in a data dictionary and in a referenced dictionary), the function removes all definitions matching the specified variable names.

    example

    Examples

    collapse all

    dd = Simulink.data.connect("myDictionary.sldd");
    clear(dd,"x");
    matFile = Simulink.data.connect("myMatFile.mat");
    clear(matFile,"x");
    mw = Simulink.data.connect("myModel.slx");
    clear(mw,["y" "z"]);

    Input Arguments

    collapse all

    Connection to data source, specified as a Simulink.data.DataConnection object.

    Variable names to remove from connected data source, specified by a string, character vector, string array, or cell array of character vectors.

    Version History

    Introduced in R2024a