Supported Operations For Associative Arrays
You can perform the following kinds of operations on associative arrays:
Create a New Element
If the associative array asa exists, the following statement adds a new expression to the array with the given key name:
asa('newkey') = expr
Concatenate
The following statement concatenates the associative arrays asa1, asa2, ... , asan in the associative array asa_new.
asa_new = [asa1, asa2,..., asan]
Subset
The following statement creates a new associative array that is a subset of an existing associative array.
note | Only the key names are required to specify the subset. |
asa_sub = asa(['key1', 'key2'])
Retrieve Keys
The ASKEYS function returns the key names for an associative array.
keys = ASKEYS(asa)
The following statements show how you can enumerate associative array elements.
keys = ASKEYS(asa)
for i = 0, N_ELEMENTS(asa) - 1 do asa(keys(i)) = expr
Test for Keys
The ISASKEY function lets you test for the presence of a key name in an associative array.
result = ISASKEY(asa, 'key')