Access array using composite symbol name

Hello,

I have several arrays which are loaded from text files, e.g. array1 = loadStrings(“marker-energy-sc2.txt”); , then array2, array3, etc.
I would need to access values in those arrays based on another value coming from a textfile with 1, 2, 3, …
I was trying to connect the string “array” and the value to create “arrayX” to access any of the first mentioned array dinamically, but it seems that I can’t use a symbol name to access an array? In java “eval” could be used for it, but it isn’t available in processing.
Is this technique possible with other means, or should I load all values into one hashmap or intdich, and structure the stringnames so that I can grab the values from there? E.g. array1-0, array1-1, etc.

best,

jmmmp

If those files happen to be CSV or TSV:

You could use loadTable() instead:

Datatype Table offers many access & lookup methods:

1 Like

Thanks, that was a very good way of solving it.