How to Loop Through Multiple Matrices in MATLAB?

  • Context: MATLAB 
  • Thread starter Thread starter TimFys
  • Start date Start date
  • Tags Tags
    Matlab Matrices
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
3 replies · 2K views
TimFys
Messages
2
Reaction score
0
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.
 
Physics news on Phys.org
You can define a three-dimensional array A(l,m,n) so that one of your indices (I forget which one it is) points to the different matrices in a loop.