remove(mapObj,keySet)
remove(
erases
all specified keys, and the values associated with them, from mapObj
,keySet
)mapObj
.
Input keySet
can be a scalar key or a cell array
of keys.
|
Object of class |
|
Scalar value, character vector, or cell array that specifies
keys in |
Create a map and view the keys and the Count
property:
myKeys = {'a','b','c','d'}; myValues = [1,2,3,4]; mapObj = containers.Map(myKeys,myValues); mapKeys = keys(mapObj) mapCount = mapObj.Count
The initial map contains four key-value pairs:
mapKeys = 'a' 'b' 'c' 'd' mapCount = 4
Remove the pairs corresponding to keys b
and d
:
keySet = {'b','d'}; remove(mapObj,keySet); mapKeys = keys(mapObj) mapCount = mapObj.Count
The modified map contains two key-value pairs:
mapKeys = 'a' 'c' mapCount = 2
containers.Map
| isKey
| keys
| values