Return values of Map object
Map
valueSet = values(M)
valueSet = values(M,keySet)
example
valueSet = values(M) returns all the values of the input Map object as a cell array.
M
valueSet = values(M,keySet) returns the values that correspond to the keys specified in the cell array keySet. The output argument valueSet has the same size as keySet.
keySet
valueSet
collapse all
Create a Map object.
ids = [437 1089 2362]; names = {'Li, N.','Jones, R.','Sanchez, C.'}; M = containers.Map(ids,names)
M = Map with properties: Count: 3 KeyType: double ValueType: char
Return a cell array containing its values.
valueSet = 1x3 cell {'Li, N.'} {'Jones, R.'} {'Sanchez, C.'}
months = {'Jan','Feb','Mar','Apr'}; rainfall = [327.2 368.2 197.6 178.4]; M = containers.Map(months,rainfall)
M = Map with properties: Count: 4 KeyType: char ValueType: double
Return values that correspond to specified keys.
keySet = {'Jan','Feb'}; valueSet = values(M,keySet)
valueSet=1×2 cell array {[327.2000]} {[368.2000]}
Return one value. Even when you specify one key, you must specify it as a cell array.
keySet = {'Apr'}; valueSet = values(M,keySet)
valueSet = 1x1 cell array {[178.4000]}
Input Map object.
Keys corresponding to values to return from the Map object, specified as a cell array.
Even when you specify keys as strings, the keys must be contained in a cell array.
containers.Map | isKey | keys | remove
containers.Map
isKey
keys
remove
You have a modified version of this example. Do you want to open this example with your edits?