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.


Class: containers.Map
Package: containers

Identify keys of containers.Map object


keySet = keys(mapObj)


keySet = keys(mapObj) returns cell array keySet, which contains all of the keys in mapObj.

Input Arguments


Object of class containers.Map.

Output Arguments


1-by-n cell array, where n is the number of keys in mapObj.


Get the Keys in a Map

Create a map, and view the keys in the map:

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

keySet = keys(mapObj)

This code returns 1-by-3 cell array keySet:

keySet = 

    'a'    'b'    'c'
Was this topic helpful?