% Transpose M

clear all

M= rand(3,4)
[nr, nc] = size(M);

for  r= 1: nr
    for c= 1: nc
        A(c,r)= M(r,c);
    end
end

disp('After transpose operation:')
disp(A)