insert
Description
d2 = insert(
assigns the d1,key,value)value to key in dictionary,
d2. If key already has a corresponding value,
then insert overwrites the value.
d = insert(d,key,value) is equivalent to d(key) =
value.
Examples
Input Arguments
Tips
A dictionary maps keys to values element-wise, allowing vectorized lookup and insert. Keys and values must each consist of elements of the same or compatible data type. To store nonscalar or heterogeneous values, use a cell array.
For example, to insert tables as values in a dictionary:
d = dictionary(); t1 = table(1,2); t2 = table(1,2,3); d(["table1" "table2"]) = {t1,t2}
d = dictionary (string ⟼ cell) with 2 entries: "table1" ⟼ {1×2 table} "table2" ⟼ {1×3 table}