How to plot quivers only on pixels with an intensity greater than 0?

3 ビュー (過去 30 日間)
Flint Marko
Flint Marko 2021 年 9 月 20 日
編集済み: Cris LaPierre 2021 年 9 月 20 日
I am trying to quantify the direction of my quiver plot, but quivers stemming from pixels with an intensity of 0 tend to skew the data. Therefore, I want to stop quivers from being plotted on pixels with an intensity of 0.

採用された回答

Cris LaPierre
Cris LaPierre 2021 年 9 月 20 日
quiver will not plot nan, so a simple solution may be to replace any value of 0 with nan.
U(U==0)=nan;
V(V==0)=nan;
quiver(X,Y,U,V)
  3 件のコメント
Cris LaPierre
Cris LaPierre 2021 年 9 月 20 日
編集済み: Cris LaPierre 2021 年 9 月 20 日
That was an example of how to get quiver to not draw vectors that met some underlying condition. You can use the variable containing intensity values (which should be the same size as U and V).
U(intensity==0)=nan;
V(intensity==0)=nan;
quiver(X,Y,U,V)
Flint Marko
Flint Marko 2021 年 9 月 20 日
Your suggestion worked! Thanks for the help.

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by