Next: Cell Arrays, Previous: Structures, Up: Data Containers [Contents][Index]

### 6.2 containers.Map

m = containers.Map ()
m = containers.Map (keys, vals)
m = containers.Map (keys, vals, `"UniformValues"`, is_uniform)
m = containers.Map (`"KeyType"`, kt, `"ValueType"`, vt)

  Create an object of the containers.Map class that stores a list of key/value pairs.

  keys is an array of unique keys for the map. The keys can be numeric scalars or strings. The type for numeric keys may be one of `"double"`, `"single"`, `"int32"`, `"uint32"`, `"int64"`, or `"uint64"`. Other numeric or logical keys will be converted to `"double"`. A single string key may be entered as is. Multiple string keys are entered as a cell array of strings.

  vals is an array of values for the map with the same number of elements as keys.

  When called with no input arguments a default map is created with strings as the key type and `"any"` as the value type.

  The `"UniformValues"` option specifies whether the values of the map must be strictly of the same type. If is_uniform is true, any values which would be added to the map are first validated to ensure they are of the correct type.

  When called with `"KeyType"` and `"ValueType"` arguments, create an empty map with the specified types. The inputs kt and vt are the types for the keys and values of the map respectively. Allowed values for kt are `"char"`, `"double"`, `"single"`, `"int32"`, `"uint32"`, `"int64"`, `"uint64"`. Allowed values for vt are `"any"`, `"char"`, `"double"`, `"single"`, `"int32"`, `"uint32"`, `"int64"`, `"uint64"`, `"logical"`.

  The return value m is an object of the containers.Map class.

  See also: struct.

Next: Cell Arrays, Previous: Structures, Up: Data Containers [Contents][Index]