MATLAB: Strange output from sort()

sort

If I sort an array using
[a,b]=sort(c);
I expect the smallest value of c to be at the index of b==1
However, when I do
find(b==1)
I get a completely different and wrong answer (in this case index 85), compared to
find(c==min(c))
which gives met the index of the actual smallest value (index 69).
Can anyone explain what's happening here?

Best Answer

No, the smallest value of c will be at location b(1) . The b output is the original indices of the corresponding entries in a