entries
All keys and values of a dictionary, as a table.
Category: Language Fundamentals > Data Types
Syntax
T = entries(d)
Returns a table with variables Key and Value, one row per entry.
Description
A table is convenient for display, sorting and further processing: sortrows(T, 'Key') orders the entries, and T.Key and T.Value give the columns. It is a snapshot; changing T does not change the dictionary. keys(d) and values(d) give just one of the two columns.
Input arguments
d- dictionary object.
Output arguments
T- table with
KeyandValuevariables.
Example
Table of entries
d = dictionary(["a" "b"], [1 2]);
T = entries(d)
T.Value'
Output
T = 2×2 table
Key Value
___ _____
"a" 1
"b" 2
ans = 1×2
1 2