This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


Class: containers.Map
Package: containers

Identify values in containers.Map object


valueSet = values(mapObj)
valueSet = values(mapObj,keySet)


valueSet = values(mapObj) returns all of the values in mapObj.

valueSet = values(mapObj,keySet) returns values that correspond to the specified keys.

Input Arguments


Object of class containers.Map.


Cell array that specifies keys in mapObj.

Output Arguments


Cell array containing values from mapObj. If you specify keySet, the valueSet array has the same size and dimensions as keySet.


Get All Values in a Map

Create a map, and view all values in the map:

myKeys = {'a','b','c'};
myValues = [1,2,3];
mapObj = containers.Map(myKeys,myValues);

valueSet = values(mapObj)

This code returns 1-by-3 cell array valueSet:

valueSet = 

    [1]    [2]    [3]

Get Selected Values in a Map

View the values corresponding to keys a and c in mapObj, created in the previous example:

keySet = {'a','c'};
valueSet = values(mapObj,keySet)

This code returns 1-by-2 cell array valueSet:

valueSet = 

    [1]    [3]

See Also

| |

Was this topic helpful?