dictionary

Methods

Method Reference: dictionary.keys

dictionary: k = keys (d)

dictionary: k = keys (d, format)

Return the keys.

k = keys (d) returns the keys of d as a column array of the key type, in the order they were added. Keys of a type that cannot be joined into one array, such as function handles, are refused unless there is exactly one.

k = keys (d, format) returns them as above for format 'uniform', the default, and as a column cell array, each key in a cell of its own, for 'cell'. format is matched in any case and by its first letters.

d must be configured.

See also: dictionary.values, dictionary.isKey, dictionary.numEntries

Source Code: dictionary

keys returns the keys as a column of the key type, in the order they were added, or each in a cell of its own.

 d = dictionary (datetime (2024, 1, [15, 3, 9]), [120, 95, 101])
d =

  dictionary (datetime ⟼ double) with 3 entries:

    15-Jan-2024 ⟼ 120
    03-Jan-2024 ⟼ 95
    09-Jan-2024 ⟼ 101
 keys (d)
ans =
  3x1 datetime array

    15-Jan-2024    
    03-Jan-2024    
    09-Jan-2024
 keys (d, 'cell')
ans =
  3x1 cell array

    {[15-Jan-2024]}    
    {[03-Jan-2024]}    
    {[09-Jan-2024]}