function [nstruct] = structsort(ostruct, indx)
% sort otruct fields with indx
% remember to NOT sort ostruct.mday  first!!!!
fno=fieldnames(ostruct);
for i=1:size(fno,1)
    field_name=fno{i};
    cmd=['nstruct.' field_name ' =  ostruct.' field_name '(indx);'];
   % disp(['structsort; cmd ' cmd]);
    eval(cmd);
end
