A Map is a type of fast key lookup data structure that offers a flexible means of indexing into its individual elements. Unlike most array data structures in the MATLAB® software that only allow access to the elements by means of integer indices, the indices for a Map can be nearly any scalar numeric value or a character string.
Indices into the elements of a Map are called keys. These keys, along with the data values associated with them, are stored within the Map. Each entry of a Map contains exactly one unique key and its corresponding value. Indexing into the Map of rainfall statistics shown below with a string representing the month of August yields the value internally associated with that month, 37.3.
Mean monthly rainfall statistics (mm)
Keys are not restricted to integers as they are with other arrays. Specifically, a key may be any of the following types:
1-by-N character array
Signed or unsigned scalar integer
The values stored in a Map can be of any type. This includes arrays of numeric values, structures, cells, strings, objects, or other Maps.
Note: A Map is most memory efficient when the data stored in it is a scalar number or a character array.