%% Values Corresponding to Specified Keys
% Create a Map object.

months = {'Jan','Feb','Mar','Apr'};
rainfall = [327.2 368.2 197.6 178.4];
M = containers.Map(months,rainfall)

%
% Return values that correspond to specified keys.

keySet = {'Jan','Feb'};
valueSet = values(M,keySet)

%
% Return one value. Even when you specify one key, you must specify it as a cell array.

keySet = {'Apr'};
valueSet = values(M,keySet)

% Copyright 2012 The MathWorks, Inc.