Could anyone tell me how to omit zero values while plotting the graph

12 ビュー (過去 30 日間)
Prabha Kumaresan
Prabha Kumaresan 2018 年 4 月 6 日
回答済み: Shounak Shastri 2018 年 4 月 6 日
The values of A and B are generated using the code.
A= 1.8380
2.0014
1.8425
2.0771
0
0
B= 1.9754
2.1991
2.0028
2.1659
2.1944
2.2021
i want to plot the graph with respect to the values of A and B.while plotting the graph it displays all the values.But i want to omit the value 0 while plotting.Could anyone help me how to omit the values while plotting.
  2 件のコメント
Dennis
Dennis 2018 年 4 月 6 日
You could try
A(A==0)=NaN;
before you plot
Prabha Kumaresan
Prabha Kumaresan 2018 年 4 月 6 日
thanks.It works

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

回答 (1 件)

Shounak Shastri
Shounak Shastri 2018 年 4 月 6 日
You can try this
A1 = A(A ~= 0); % Removes the zeros from A
plot(A1);
hold on;
plot(B);
hold off;
Hope this helps. Best of luck.

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by