dictionary

Methods

Method Reference: dictionary.entries

dictionary: e = entries (d)

dictionary: e = entries (d, format)

Return the keys and values together.

e = entries (d) returns a table with the variables Key and Value, one row per entry in the order the keys were added: the columns keys (d) and values (d) return. Keys or values that a table cannot hold, function handles, dictionaries or values that cannot be joined, are refused.

e = entries (d, format) returns the table above for format 'table', the default; for 'struct' a column structure array with the fields Key and Value, one element per entry; and for 'cell' a cell array of two columns, each key and value in a cell of its own. format is matched in any case and by its first letters.

d must be configured.

See also: dictionary.keys, dictionary.values

Source Code: dictionary

entries returns the keys and values together: a table by default, a structure array, or a cell array of two columns.

 d = dictionary (categorical ({'red', 'green'}), [0.8, 0.3])
d =

  dictionary (categorical ⟼ double) with 2 entries:

    red   ⟼ 0.8000
    green ⟼ 0.3000
 entries (d)
ans =
  2x2 table

     Key     Value    
    _____    _____    

      red      0.8    
    green      0.3
 s = entries (d, 'struct');
 s(2).Key
ans =
  categorical

   green
 s(2).Value
ans = 0.3000
 entries (d, 'cell')
ans =
  2x2 cell array

    {[red  ]}    {[0.8]}    
    {[green]}    {[0.3]}