Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

length

Class: containers.Map
Package: containers

Length of containers.Map object

Syntax

mapLength = length(mapObj)

Description

mapLength = length(mapObj) returns the number of key-value pairs in mapObj.

Input Arguments

mapObj

Object of class containers.Map.

Output Arguments

mapLength

Scalar numeric value that indicates the number of key-value pairs in mapObj. This number is equivalent to size(mapObj,1) and to mapObj.Count.

Examples

Determine the Length of a Map

Create a map, and determine the number of key-value pairs:

myKeys = {'a','b','c'};
myValues = [1,2,3];
mapObj = containers.Map(myKeys,myValues);

mapLength = length(mapObj)

This code returns

mapLength =

     3
Was this topic helpful?