How to skip values in matrix and plot it properly

1 回表示 (過去 30 日間)
Hyun-su Kim
Hyun-su Kim 2019 年 12 月 9 日
コメント済み: Guillaume 2019 年 12 月 9 日
Let say, I have two matrix,
A = [0, 0, 3, 4, 0, 0]
B = [0, 1, 4, 4, 0, 0]
I want to calculate following,
G = A/B
And I want to plot as ordered.
X = [1,2,3,4,5,6], Y = [Non, Non, 3/4, 4/4, Non, Non]
How it can be done simply?
Thank you in advance.

回答 (1 件)

Bhaskar R
Bhaskar R 2019 年 12 月 9 日
As of my knowledge, we can't plot NaNs so there is 3 points are visible in your plot as
A = [0, 0, 3, 4, 0, 0];
B = [0, 1, 4, 4, 0, 0];
G = A./B;
X = [1,2,3,4,5,6]
plot(X, G); % or plot(1:length(G), G)
  1 件のコメント
Guillaume
Guillaume 2019 年 12 月 9 日
"As of my knowledge, we can't plot NaNs". Well yes, how would you plot a NaN (Not A Number)?

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

カテゴリ

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