| Contents | Index |
Determine if containers.Map object contains key
tf = isKey(mapObj,keySet)
tf = isKey(mapObj,keySet) looks for the specified keys in 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.
mapObj |
Object of class containers.Map. |
keySet |
Scalar value, string, or cell array that specifies keys to find in mapObj. |
tf |
Array of logical values. If keySet is a scalar or a string, tf is a scalar. Otherwise, tf has the same size and dimensions as keySet. |
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 0Determine if mapObj from the previous example contains key Feb:
keySet = 'Feb'; tf = isKey(mapObj,keySet)
This code returns scalar tf:
tf =
1containers.Map | keys | remove | values
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |