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

keys

Class: containers.Map
Package: containers

Identify keys of containers.Map object

Syntax

keySet = keys(mapObj)

Description

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

Input Arguments

mapObj

Object of class containers.Map.

Output Arguments

keySet

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

Examples

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?