How I can print out only the numbers over the threshold and keep each number in the same place ?

1 回表示 (過去 30 日間)
How I can print out only the numbers over 30 and keep each number in the same place ? to able to plot and shows which sample is over 30 !
I want show the real value 30-50 = 20 not 1 and zero !
x= randi([20 50],163,50)
  1 件のコメント
darova
darova 2020 年 4 月 7 日
plot( randi([3 5],10,10) )
ylim([ 2 6 ])
Everything is between 3 .. 5. What is the problem?

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

採用された回答

Sindar
Sindar 2020 年 4 月 8 日
Plots will exclude NaN values, but keep the rest of the data in place. So, here's a trick:
data ./ (condition)
Where condition is true, this will return the data (data/1)
Where condition is false, this will return NaN (data/0)
So:
y = randi([20 50],163,50);
miny = 30;
plot(y./(y>=miny))

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by