Map data with keys that index values
A dictionary is a data structure that associates each key with a corresponding value. Keys and values can be of any data type, providing more flexibility for data access than array indices and improved performance.
dictionary is recommended over
containers.Map because it supports more data types as
keys and values and provides better performance. (since R2022b)
|Object that maps unique keys to values|
|Key-value pairs of dictionary|
|Keys of dictionary|
|Values of dictionary|
|Types of dictionary keys and values|
|Number of key-value pairs in dictionary|
|Determine if dictionary has types assigned to keys and values|
|Determine if dictionary contains key|
|Generate hash code for dictionary key|
|Determine if two dictionary keys are the same|
Legacy Map Containers
- Map Data with Dictionaries
Use dictionaries to store key-value pairs of different data types.
- Dictionaries and Custom Classes
Modify custom classes for expected behavior in dictionaries.