
4 Programming
M(:,:,k) = A(:,p(k,:));
end
stores the sequence of 24 magic squares in a three-dimensional array, M.The
size of
M is
size(M)
ans =
4424
Note The order of the matrices shown in this illustration might differ from
your results. The
perms function always returns all permutations of the input
vector, but the order of the permutations might be different for different
MATLAB versions.
The statement
sum(M,d)
computes sums by varying the dth subscript. So
sum(M,1)
is a 1-by-4-by-24 array containing 24 copies of the row vector
4-10
Comentários a estes Manuais