Matlab, how to filter a numeric vector by a condition?
>> Xb = X(X < 0.005)
Xb =
0.0010 0.0030
What you did with the code Xb=X<0.005
was to create a mask. Simply put, it tells you which values are less than 0.005, but with no sorting of the list. What you want is to sort the list by the mask, which can be done as jlrcowan has suggested.