Map Containers
Store data values in aMap
object, which is a data structure that associates each value with a corresponding key. AMap
object is similar to a dictionary or associative array in that you can use keys to retrieve values from it. Keys can be numbers or text, providing more flexibility for data access than array indices.
Funzioni
containers.Map |
Object that maps unique keys to values |
isKey |
Determine ifMap object contains key |
keys |
Return keys ofMap object |
remove |
Delete key-value pairs fromMap object |
values |
Return values ofMap object |
Argomenti
- Overview of Map Data Structure
A Map is a type of fast key lookup data structure that offers a flexible means of indexing into its individual elements. The indices for a Map can be nearly any scalar numeric value or a character vector.
- Description of Map Class
A Map is an object, or instance, of the
containers.Map
class. - Create Map Object
Create a Map using the
containers.Map
class. - Examine Contents of Map
This example shows how to find all the keys and values in a Map.
- Read and Write Using Key Index
This example shows how to read from a Map structure and how to add new key/value pairs.
- Modify Keys and Values in Map
This example shows how to remove and modify keys and values in a Map structure.
- 泰映射到不同的值pes
This example shows how to store structures or cell arrays in a Map structure.