How to skip zeros values form a matrix and plot with a time values?

3 ビュー (過去 30 日間)
Rajeev Kumar
Rajeev Kumar 2022 年 9 月 26 日
回答済み: Simon Chan 2022 年 9 月 26 日
I have a two array
A = [1,2,3,4,0,6,7,0,9,10,11,0,13,14,15];
Now skip the zeros form the array A and also skip the crossponding index form the time (t) array. and make a plot in between them?

回答 (1 件)

Simon Chan
Simon Chan 2022 年 9 月 26 日
You may put those zero to NaN and plot it. It will skip those points.
A = [1,2,3,4,0,6,7,0,9,10,11,0,13,14,15];


Find more on Resizing and Reshaping Matrices in Help Center and File Exchange


Community Treasure Hunt

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

Start Hunting!

Translated by