function o_X = order_vector_from_center(X)
%#codegen

    o_X = zeros(size(X));
    n = length(X);
    if mod(n,2)==0
       ks = 0:(n/2-1);
       o_X_s = reshape([n/2-ks; n/2+ks+1],n,1);
       o_X(1:n) = X(o_X_s(1:n));
    else
       ks = 0:(n-3)/2;
       o_X_s = reshape([ (n-1)/2-ks ; (n+1)/2+ks],n-1,1);
       o_X(1:n-1) = X(o_X_s);
       o_X(n) = X(n);
    end
end