Products & Services Industries Academia Support User Community Company

Learn more about MATLAB   

length (Map) - Length of containers.Map object

Syntax

L = length(M)

Description

L = length(M) returns the number of pairs in the map M. The number returned by this method is equivalent to size(M,1).

Read more about Map Containers in the MATLAB Programming Fundamentals documentation.

Examples

Create a Map object containing the names of several US states and the capital city of each:

US_Capitals = containers.Map( ...
{'Arizona', 'Nebraska', 'Nevada', 'New York', ...
 'Georgia', 'Alaska', 'Vermont', 'Oregon'}, ...
{'Phoenix', 'Lincoln', 'Carson City', 'Albany', ...
 'Atlanta', 'Juneau', 'Montpelier', 'Salem'});

Find out how many keys are in the map:

length(US_Capitals)
ans =
     8

This should be equal to the Count property for the object:

length(US_Capitals) == US_Capitals.Count
ans =
     1

See Also

containers.Map, keys(Map), values(Map), size(Map), isKey(Map), remove(Map), handle

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS