라이선스가 부여된 사용자만 번역 문서를 볼 수 있습니다. 번역 문서를 보려면 로그인하십시오.

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?