| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
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.
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
containers.Map, keys(Map), values(Map), size(Map), isKey(Map), remove(Map), handle
![]() | length | length (serial) | ![]() |

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 |