dictionary

Methods

Method Reference: dictionary.values

dictionary: v = values (d)

dictionary: v = values (d, format)

Return the values.

v = values (d) returns the values of d as a column array of the value type, in the order their keys were added. Values that cannot be joined into one array, such as function handles, dictionaries or structures with different fields, are refused unless there is exactly one. Tables are joined only when each has one row, so that row i is the value of key i.

v = values (d, format) returns them as above for format 'uniform', the default, and as a column cell array, each value 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.keys, dictionary.numEntries

Source Code: dictionary

values returns the values as a column of the value type, in the order of their keys. Function handles cannot be joined into an array, so a dictionary of them gives its values as a cell array.

 d = dictionary (string ({'x', 'y', 'z'}), [10, 20, 30])
d =

  dictionary (string ⟼ double) with 3 entries:

    "x" ⟼ 10
    "y" ⟼ 20
    "z" ⟼ 30
 values (d)
ans =

   10
   20
   30
 f = dictionary ('sin', @sin);
 f('cos') = @cos
f =

  dictionary (string ⟼ function_handle) with 2 entries:

    "sin" ⟼ @sin
    "cos" ⟼ @cos
 fns = values (f, 'cell');
 fns{2} (0)
ans = 1