isKey

Check if dictionary contains key

Syntax

  • tf = isKey(d)

Input argument

  • d - scalar: dictionary object.

Output argument

  • tf - scalar logical: true if key, false if not.

Description

tf = isKey(d, key) returns a logical true if the specified key exists in the configured dictionary, and a logical false if it does not.

If d is an unconfigured dictionary, isKey throws an error.

If key is an array of multiple keys, then tf is a logical array of the same size.

Example

names = ["Biil" "John" "Yann"];
wheels = [1 2 3];
d = dictionary(wheels, names)
tf = isKey(d, "John")
tf = isKey(d, ["biil" , "Yannis")

See also

dictionary, configureDictionary, keys.

History

VersionDescription

1.5.0

initial version

Author

Allan CORNET

Last updated