by TomDoan » Thu Apr 19, 2012 10:02 am
Use %RESHAPE. For instance
dec vect myvect(12)
ewise myvect(i)=i
compute my3by4=%reshape(myvect,3,4)
That will give
1 4 7 10
2 5 8 11
3 6 9 12
since RATS fills matrices by columns. If you want to reshape in the other direction, you would do
compute my3by4=tr(%reshape(myvect,4,3))
which will give
1 2 3 4
5 6 7 8
9 10 11 12