FUNCTION REFERENCE

containers.Map

Create a map from keys to values (a handle object).

Create a map from keys to values (a handle object).

Syntax

m = containers.Map(keys, values)

Syntax

m = containers.Map('KeyType', kt, 'ValueType', vt)

Syntax

m = containers.Map(keys, values, 'UniformValues', tf)

Keys are char rows or real scalars (double, single, int32, uint32, int64, uint64), kept sorted. m(key) reads a value and m(key) = value adds or replaces one. Properties: Count (uint64), KeyType, ValueType. Copies such as m2 = m share one map. size(m) is [Count 1].

Example

m = containers.Map({'a','b'}, {1, 2}); m('b')   % 2

Example

m = containers.Map(); m('k') = 7; m2 = m; m2('j') = 8; m.Count   % 2

Differences from MATLAB: none known.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.