Main Content

clear

Remove specified variables from connected data source

Since R2024a

    Description

    example

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

    If the data connection can see 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.

    Examples

    collapse all

    dd = Simulink.data.connect('myDictionary.sldd');
    clear(dd, '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, array of strings, or cell array of character vectors.

    Version History

    Introduced in R2024a