From: Namo Namo on
Thanks for the reply. Yes, the second output of unique is already what I want.

I actually had a more general re-assignment problem to deal with, in which not just re-assign to the order stats. But now I find out I can just use table lookup or interp1. Say if I want to convert 3 1 4 to 1 2 3, and need to apply this conversion to a large matrix X, I can just do

interp1([3 1 4], [1 2 3], X)

and it replaces 3 1 4 in X to 1 2 3.