Documentation Center

  • Trial Software
  • Product Updates

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

See Also

| | | |

Was this topic helpful?