MATLAB: Run the same code with multiple variables.

for looploopmatrix

Hi!
I have 10-20 different matrices, each containing a set of coordinates (one longitude column & one latitude column). I wrote a code to calculate stuff for one matrix, but I want to loop the whole code for all of my matrices.
I need to compare the results from each matrix, so their results have to end up in a joint new matrix.
Thank you!

Best Answer

It might be convenient to store each of the 10-20 matrices as one cell in a cell array, since that doesn't require that they have the same size. Then, for each cell, call the code to process the one array in that cell.