dictionary

Methods

Method Reference: dictionary.isKey

dictionary: tf = isKey (d, keys)

True for each of the keys that is in the dictionary.

tf = isKey (d, keys) returns a logical array of the size of keys, true where the element of keys is a key of d. The keys are first converted to the key type of d, as dictionary converts them, so that isKey (d, 1) on a dictionary of string keys asks for the key "1"; a class that cannot be converted is refused. d must be configured.

See also: dictionary.keys, keyMatch

Source Code: dictionary

isKey answers for each element of an array of keys, after converting them to the key type: a number asks for its text in a dictionary of string keys.

 d = dictionary (string ({'1', '2', 'three'}), [1, 2, 3])
d =

  dictionary (string ⟼ double) with 3 entries:

    "1"     ⟼ 1
    "2"     ⟼ 2
    "three" ⟼ 3
 isKey (d, {'three', 'four'; '1', 'one'})
ans =

  1  0
  1  0
 isKey (d, 2)
ans = 1