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

 採用された回答

KSSV
KSSV 2022 年 6 月 23 日

0 投票

If P is your array if size 1x27331.
P(P<0.1) = NaN ;

3 件のコメント

ELISABETTA BILLOTTA
ELISABETTA BILLOTTA 2022 年 6 月 23 日
it gives me an error .. it creates me a matrix made only of values = NaN and also deletes all the values greater than 0.1 that I need to make the graph with countourf
KSSV
KSSV 2022 年 6 月 23 日
Do you have a vector or a matrix?
It should not show error, Show us your data.
ELISABETTA BILLOTTA
ELISABETTA BILLOTTA 2022 年 6 月 23 日
ok it works!!! thanks a lot

サインインしてコメントする。

その他の回答 (1 件)

Chunru
Chunru 2022 年 6 月 23 日

0 投票

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 件のコメント

ELISABETTA BILLOTTA
ELISABETTA BILLOTTA 2022 年 6 月 23 日
it gives me an error .. it creates me a matrix made only of values = NaN and also deletes all the values greater than 0.1 that I need to make the graph with countourf
Chunru
Chunru 2022 年 6 月 24 日
Are you sure you use the same code?

サインインしてコメントする。

カテゴリ

ヘルプ センター および File Exchange2-D and 3-D Plots についてさらに検索

タグ

質問済み:

2022 年 6 月 23 日

コメント済み:

2022 年 6 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by