Main Content


Determine whether variable exists in connected data source

Since R2024a



    varExists = exist(connectionObj, varNames) returns 1 (true) if the specified variable names exist in the connected data source, and 0 (false) otherwise. If varNames is an array, the output varExists is an array of the same size as varNames, and varExists(i) indicates whether the variable name varNames(i) exists in the connected data source.

    If a data connection can see multiple data sources (for example, a data dictionary and its referenced dictionaries), the function returns true if the variable exists in any of the visible data sources.


    collapse all

    dd ='myDictionary.sldd');
    exist(dd, 'a')
    dd ='myDictionary.sldd');
    dd.a = 1;
    dd.c = 3;
    exist(dd, ["a" "b" "c"])
    ans = 
      1×3 logical array
       1   0   1

    Input Arguments

    collapse all

    Connection to data source, specified as a object.

    Variable names, specified by a string, character vector, array of strings, or cell array of character vectors.

    Version History

    Introduced in R2024a