I have created a program in MatLab doing LU factorization and need to implement a routine, so that MatLab automatically runs the program on all of my matrices. I have 6 matrices A1, A2, A3, A4, A5 and A6. But for the time being I can only run the program for one matrix, write the result down and then change the input matrix. Is there a smart way of making a loop so that MatLab automatically changes the input matrix? The notation A(i) does not work, since it refers to the elements in the matrix.