I have two matrix: matrix A is 18 by 18 and Matrix B is 18 by 2, I want to multiply them and get new matrix. Then matrix A will multiply the new matrix again, I want to do it 100 times. Can I do it by making matrix B as an array with 18 by 2 by 100 dimension? I can not figure out how to do the loop? using apply? Thanks a lot! Su Su