On Jan 11, 7:58 am, Nicola Bressanin <nicola.bressa
...@gmail.com>
wrote:
> I needed a program to read a few 3x3 matrices containing
> variables,like N and T.
> N and T are stored in the same directory; when invoking the program
> (SOST) the newer N and T are present on stack levels 1 and 2.I solved
> it with ->NUM in this program,but was there another(better) way to do
> it?is SUBST helpful?
> SOST
> <<
> 'T' STO
> 'N' STO
> Rr1 Rr2 Rr3 Rr4
> ->NUM 'Rr4S' STO
> ->NUM 'Rr3S' STO
> ->NUM 'Rr2S' STO
> ->NUM 'Rr1S' STO
> Rr1S Rr2S Rr3S Rr4S
From the listing you posted, it appears that Rr1, Rr2, Rr3, and Rr4
are static. Suppose that Rr1 looks like:
[ [ 1 2 N ] [ 4 5 T ] [ 7 8 9 ] ]
You could use:
<<
-> T N
<<
[ [ 1 2 N ] [ 4 5 T ] [ 7 8 9 ] ]
... insert the other 3 matrices here ...
>>
This treats T and N as local variables. It takes T and N from the
stack, and then leaves four matrices with the T and N values
substituted into the matrices themselves for you to do whatever you
wish with them. This reduces the number of variables you have to keep
around in your directory.