MATLAB: How to not exceed limits of the matrix column

2d arrayloopMATLAB

for eg, i have matrix A=[4 6 3 8 9 5;1 7 2 4 3 4;7 8 5 6 1 2; 1 8 4 7 10 6;] and i use a for loop to go across the column, for i =1:col …. how do i stop it before getting error of matrix exceeds dimensions

Best Answer

your_array = rand(10,16)
%looping through all columns
for ii=your_array
%ii now contains all values in column
end