MATLAB: Make a transpose function in for loop

homework

I have to make transpose function in for loop for matrix. I am trying to get it to work but it needs some imporvements.
function cd=MyTranspose(A)
[row col] = size(A);
for m=1:length(row)
for n=1:length(col)
cd(n,m)=A(m,n);
end
end

Best Answer

Suggested improvement: do not use a variable name of "cd", as that conflicts with the commonly-used MATLAB routine cd() . Get out of the habit now of using variable names that match common MATLAB routines, before you get stuck calling your variables "sum" and having a heck of a time debugging your program.
Other than the above: You need to be more specific about what you were hoping for from us, keeping in mind that since this is an assignment you are doing, we are likely to avoid giving you anything that might be considered an "answer" to the assignment.
Related Question