I'm trying to do the following with arrayfun and circshift
s_dfp = magic(4);s_hh1p = circshift(s_dfp(:,1),[1 -1]);s_hh2p = circshift(s_dfp(:,2),[1 -2]);s_hh3p = circshift(s_dfp(:,3),[1 -3]);s_hh4p = circshift(s_dfp(:,4),[1 -4]);HH = [s_hh1p s_hh2p s_hh3p s_hh4p];s_dfp = 16 2 3 13 5 11 10 8 9 7 6 12 4 14 15 1HH = 4 14 15 1 16 2 3 13 5 11 10 8 9 7 6 12Each column is shifted by its column number. I would like to do this for arbitrary size.
Thanks in advance.
Best Answer