I want to take mean of each row/column without mean command.
I created this code but its not working, however it was working with For loop. As I changed it to while loop. Its not working.
A = [0:2:8;2:1:6;9:3:21]
dim = size(A);
mean = zeros(1,dim(2));
while j <= dim(2)
while i <= dim(1)
mean(j) = mean(j) + A(i,j);
mean(j) = mean(j) / dim(1);
If I have a matrix like
A = [1 2 3 4; 4 3 2 1; 3 2 1 4]
and want to call each row or column individually, then I want to perform some operation on that individual row elements. i.e I want to add the elements of each row and column and then I want to take mean of those row and column separately. I want to do it with loop function.