| Contents | Index |
Remove key-value pairs from containers.Map object
remove(mapObj,keySet)
remove(mapObj,keySet) erases all specified keys, and the values associated with them, from mapObj. Input keySet can be a scalar key or a cell array of keys.
mapObj |
Object of class containers.Map. |
keySet |
Scalar value, string, or cell array that specifies keys in mapObj to delete. |
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.CountThe initial map contains four key-value pairs:
mapKeys =
'a' 'b' 'c' 'd'
mapCount =
4Remove the pairs corresponding to keys b and d:
keySet = {'b','d'};
remove(mapObj,keySet)
mapKeys = keys(mapObj)
mapCount = mapObj.CountThe modified map contains two key-value pairs:
mapKeys =
'a' 'c'
mapCount =
2containers.Map | isKey | keys | values
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |