Dictionaries
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)
Functions
dictionary | Object that maps unique keys to values |
entries | Key-value pairs of dictionary |
keys | Keys of dictionary |
values | Values of dictionary |
types | Types of dictionary keys and values |
numEntries | Number of key-value pairs in dictionary |
isConfigured | Determine if dictionary has types assigned to keys and values |
isKey | Determine if dictionary contains key |
keyHash | Generate hash code for dictionary key |
keyMatch | Determine if two dictionary keys are the same |
Classes
Topics
- 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.