From: Matt Fig on
Or, if you prefer explicit FOR loops:

% Another, probably faster method.
idx = perms(1:size(x,1));
C = cell(size(idx,1),1);

for ii = 1:size(idx,1)
C{ii} = x(idx(ii,:),:);
end