how to remove values below 0.1?

1 view (last 30 days)
ELISABETTA BILLOTTA
ELISABETTA BILLOTTA on 23 Jun 2022
Commented: Chunru on 24 Jun 2022
after doing a series of calculations I obtained a prob(i)=1x27331 double matrix characterized by values ranging from 0 to about 0.4.
How can I remove all points with values less than 0.1 and change them to NaN?
I need these values below 0.1 to become worthless so that when plotting them they are not marked.
i tried with :
old = lt(prob(i),0.1);
new = NaN;
prob(i) = changem(prob(i),new,old);
...but it doesn't work.
Can anyone help me?
thanksss

Accepted Answer

KSSV
KSSV on 23 Jun 2022
If P is your array if size 1x27331.
P(P<0.1) = NaN ;
  3 Comments
ELISABETTA BILLOTTA
ELISABETTA BILLOTTA on 23 Jun 2022
ok it works!!! thanks a lot

Sign in to comment.

More Answers (1)

Chunru
Chunru on 23 Jun 2022
a = 0.4*rand(100,1); % generate some data
a(a<0.1) = nan
a = 100×1
0.1696 0.3018 0.1866 0.2110 NaN 0.3823 0.1434 0.3446 0.3606 0.3845
  2 Comments
Chunru
Chunru on 24 Jun 2022
Are you sure you use the same code?

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!