W3cubDocs

/Octave

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.

© 1996–2018 John W. Eaton
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.
https://octave.org/doc/interpreter/containers_002eMap.html