function i = argsort(X,order)

if ~exist('order','var')
    order = 'ascend';
end
 
[~,i] = sort(X,order);

end