To find the mean of rows and columns of a matrix using for loops in Matlab, we can first define a matrix and initialize variables to keep track of row and column wise sums. Then we can loop through each row and column using nested for loops, adding up the elements of each row and column as we go. Finally, we can divide the row and column wise sums by the number of elements in each row and column, respectively, to obtain their respective means.
main.m603 chars25 lines
This will output:
main.m67 chars5 lines
gistlibby LogSnag