MATLAB: Attempting to rearrange a 3×3 “magic” matrix

MATLABmatricestemp1

[EDIT: Sat Jun 25 00:40:09 UTC 2011 – Reformat – MKF]
Hello, here is the code that I am currently attempting to get to take the given matrix and move the rows up 1 to get the top row on the bottom and each row moved up one spot, so the 2nd row is on the top, and the last row is now in the middle. When I attempt to use the code provided for example 2.3, I get the top row and the last row to swap, but of course that is not what the question is asking, what am I doing wrong? I can fix the problem, but I will have to not follow the directions to get it done. Thanks…
clc
clear
matr = magic(3)
Temp1 = matr(1,:);
matr(1,:) = matr(3,:);
matr(3,:) = Temp1;
Temp1 = matr(2,:);
matr

Best Answer

try
doc circshift