Main Content

length

Number of key-value pairs inMapobject

Syntax

Description

example

L = length(M)returns the number of key-value pairs in the inputMapobject.length(M)相当于size(M,1)and to the propertyM.Count.

Examples

collapse all

Create aMapobject.

months = {'Jan','Feb','Mar','Apr'}; rainfall = [327.2 368.2 197.6 178.4]; M = containers.Map(months,rainfall)
M = Map with properties: Count: 4 KeyType: char ValueType: double

Return the number of key-value pairs that it contains.

L = length(M)
L = 4

Input Arguments

collapse all

InputMapobject.

Version History

Introduced in R2008b