Line Plot and NaN Values

20 ビュー (過去 30 日間)
Nathan
Nathan 2012 年 3 月 9 日
編集済み: FSh 2021 年 4 月 14 日
Hi,
I have several matrices that I am trying to graph on the same plot, except that some of the matrices contain lots of NaN values, so when I plot these matrices they appear as dots (or as a marker if I set it). Is there a way to force matlab to drawn lines between the existing points, without having to recreate the matrices such that no NaN values exist?
Thank you
  1 件のコメント
FSh
FSh 2021 年 4 月 14 日
編集済み: FSh 2021 年 4 月 14 日
You can use fillmissing function but then start your line from the first not NAN value.
create_new_var= fillmissing(your_array_with_nan,'linear');% to interpolate for the NAN and create a line
fid_first_notNAN = find(~isnan(backscatter_db_corrected40), 1);
plot(x, create_new_var(id_first_notNAN:end));

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

採用された回答

Walter Roberson
Walter Roberson 2012 年 3 月 9 日
No there is not. nan and infinities always mean a break in drawing the line.

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by