I am trying to take user-inputted numbers and put them into a matrix in my program code. I have tried about two dozen permutations of things, and I can't seem to define any number past Row 1, Column 1. Essentially I am trying to use the TI-BASIC equivalent of what would be x = A(r,c)
in MATLAB. The :List>Matr({Lv},[B]
line is where the program stops.
I hope that I have made my question clear; I am happy to clarify any questions that you may have in assisting me. Thank you!
Program Code
:Disp "HOW MANY ROWS, COLUMNS?"
:Prompt R,C
:{R,C->dim([B]
:For(K,1,R,1
:For(N,1,C,1
:Disp "ENTER VALUE FOR ROW:
:Disp K
:Disp "AND COLUMN:"
:Disp N
:Prompt A
:A->Lv(K)
:End
:List>Matr({Lv},[B]
:End
First off, you don't need to include the fourth argument of the For(
loop since the default is 1. Also, the List>Matr
command only works if you are building the entire matrix at once. You should instead store each individual value into its spot in the matrix as soon as it is inputted:
:Disp "HOW MANY ROWS, COLUMNS?
:Prompt R,C
:{R,C->dim([B]
:For(K,1,R
:For(N,1,C
:Disp "ENTER VALUE FOR ROW:",K,"AND COLUMN:",N
:Prompt A
:A->[B](K,N
:End
:End