keys

Return keys of Map object

Description

example

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

Examples

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