| Contents | Index |
Size of containers.Map object
dim = size(mapObj,1)
dimVector = size(mapObj)
[dim1,dim2,...,dimN] = size(mapObj)
dim = size(mapObj,1) returns a scalar numeric value that indicates the number of key-value pairs in mapObj. If you call size with a numeric second input argument other than 1, the size method returns the scalar numeric value 1.
dimVector = size(mapObj) returns a two-element vector [k,1], where k is the number of key-value pairs in mapObj.
[dim1,dim2,...,dimN] = size(mapObj) returns [k,1,...,1].
mapObj |
Object of class containers.Map. |
Construct a map and find the number of key-value pairs:
myKeys = {'a','b','c'};
myValues = [1,2,3];
mapObj = containers.Map(myKeys,myValues);
dim = size(mapObj,1)This code returns a scalar numeric value:
dim =
3If you do not specify a second input argument,
dimVector = size(mapObj)
then the size method returns a vector:
dimVector =
3 1containers.Map | isKey | keys | length | values

Explore how to use MATLAB to make advancements in engineering and science.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |