function [ inds ] = order( x )
% like R's order(): return indices for x that give it in ascending sorted order
% e.g. order([20 30 10]) -> [3 2 1]
mat = [ x; 1:length(x) ]';
sorted = sortrows(mat);
inds = sorted(:,2);
