This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Map Containers

Objects with keys that index to values, where keys need not be integers

Functions

containers.MapObject that maps values to unique keys
isKeyDetermine if Map object contains key
keysReturn keys of Map object
removeDelete key-value pairs from Map object
valuesReturn values of Map object

Topics

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.

Map to Different Value Types

This example shows how to store structures or cell arrays in a Map structure.