How to delete NaN from column vectors ?
26 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I have two coulmn vectors, as you can see some values of y column are NaN and I would like to get rid of them and make it like x1,y1 so when for example second element of y column is NaN, I want also to get rid of the second element in x column
x = [1;2;3;4;5;6;7]
y = [1;NaN,5,NaN,12,15,18]
x1 = [1;3;5;6;7;]
y1 = [1;5;12;15;18]
0 件のコメント
回答 (1 件)
Walter Roberson
2021 年 10 月 31 日
x = [1;2;3;4;5;6;7]
y = [1;NaN;5;NaN;12;15;18]
mask = ~isnan(y);
x1 = x(mask)
y1 = y(mask)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で NaNs についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!