tf = isKey(mapObj,keySet)
looks
for the specified keys in tf
= isKey(mapObj
,keySet
)mapObj
, and returns logical true
(1
)
for the keys that it finds, and logical false
(0
)
for those it does not. keySet
is a scalar key or
a cell array of keys.
|
Object of class |
|
Scalar value, character vector, or cell array that specifies
keys to find in |
|
Array of logical values. If |
Construct a map that contains rainfall data for several months:
months = {'Jan', 'Feb', 'Mar', 'Apr'}; rainfall = [327.2, 368.2, 197.6, 178.4]; mapObj = containers.Map(months,rainfall);
Determine if keys Apr
, May
,
and Jun
are in the map:
keySet = {'Apr','May','Jun'}; tf = isKey(mapObj,keySet)
This code returns 1-by-3 vector tf
:
tf = 1 0 0
Determine if mapObj
from the previous example
contains key Feb
:
keySet = 'Feb'; tf = isKey(mapObj,keySet)
This code returns scalar tf
:
tf = 1
containers.Map
| keys
| remove
| values