In Matlab, I have a vector, X, that contains N real values:
I would like to create a new vector, Xb, that contains all the M values of X that are less than 0.005 (M <= N). How could I do it?
I've tried with:
Xb = X<0.005
but it gives me a vector of N values 0s or 1s.
Thanx
>> 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With