MATLAB: Circshift columns of array by different shift size

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 1
HH =
4 14 15 1
16 2 3 13
5 11 10 8
9 7 6 12
Each column is shifted by its column number. I would like to do this for arbitrary size.
Thanks in advance.

Best Answer

I think this does what you want.
HH=cell2mat(arrayfun(@(k) circshift(d(:,k),k),1:size(d,2),'uni',0))
HH =
4 7 10 13
16 14 6 8
5 2 15 12
9 11 3 1)
You may need to change the sign of the second k in the circshift command to get the elements to move in the direction you want.