If i understand correctly you want to get the value from a certain matrix, chosen dynamically depending on the value of a variable. You can kinda do this by putting the names of the matrices into a string, then grab a substring of the string, using sub(
, at a dynamic offset, based on L
, and then feeding that string into expr(
to get a reference to the matrix, ie
:"[A][B][C]"->Str1
, sub(Str1,2,1)
yields "[B]"
, expr("[B]")
yields Matrix B...so 2
maps to [B]
. TI considers the symbol [A]
(and all the other matrix vars) to be a single character, so "[A][B][C]"
is a 3 character string.
Note that all of the matrix vars need to be input from the MATRIX menu (including inside the string). Typing in the individual [
A
]
chracters will not work.
Also note you can't grab indexes off of a matrix returned with expr (ie expr("[A]")(1,2)
so you need an extra matrix (I used [J]
) to store the result.
For example
:"MAKE SOME MATRICES"
:[[1,2][3,4]]->[A]
:[[5,6][7,8]]->[B]
:[[9,10],[11,12]]->[C]
:"SAMPLE L VALUE"
:2->L
:"STORE REFERENCES TO THE"
:"MATRICES IN A STRING"
:"[A][B][C]"->Str1
:expr(sub(Str1, L, 1))->[J]
:"SHOWS 6"
:[J](1,2)
so then proceed normally with [J]
:If [J](E,F)
: "DO WHATEVER
Tested on an 84 SE, I assume it would work the same for anything in that family, except IIRC some older models only have matrices A-F