function config = mat2config(mat)

ni = size(mat,3);
nj = size(mat,4);

config = zeros([3 ni nj]);
config(1:2,:) = mat(1:2,3,:);
config(3,:) = atan2(mat(2,1,:),mat(1,1,:));
