Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

values (Map) - Return values of containers.Map object

Syntax

v = values(M)
v = values(M, keys)

Description

v = values(M) returns in cell array v the values that correspond to all keys in Map object M.

v = values(M, keys) returns in cell array v, those values in Map object M that correspond to the keys specified by the keys argument.

Read more about Map Containers in the MATLAB Programming Fundamentals documentation.

Examples

Create a Map object of four US states and their capital cities:

US_Capitals = containers.Map( ...
   {'Georgia', 'Alaska', 'Vermont', 'Oregon'}, ...
   {'Atlanta', 'Juneau', 'Montpelier', 'Salem'})

Find the capital cities of all states contained in the map:

v = values(US_Capitals)
v = 
    'Juneau'    'Atlanta'    'Salem'    'Montpelier'

Find the capital cities of selected states:

 = values(US_Capitals, {'Oregon', 'Alaska'})
v = 
    'Salem'    'Juneau'

See Also

containers.Map, keys(Map), size(Map), length(Map), isKey(Map), remove(Map), handle

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS