This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Return keys of Map object


keySet = keys(M)



keySet = keys(M) returns a cell array containing all the keys in the input Map object.


collapse all

Create a Map object.

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 a cell array containing its keys.

keySet = keys(M)
keySet = 1x4 cell array
    {'Apr'}    {'Feb'}    {'Jan'}    {'Mar'}

Input Arguments

collapse all

Input Map object.

Introduced in R2008b

Was this topic helpful?