delete the whole row ?

1 次查看(过去 30 天)
pruth
pruth 2018-5-21
编辑: pruth 2018-5-21
hi guys
I have a matrix.
here the first column is date and others columns are data. for eg.
I have data like this.
05/04/2018 15 54 87
06/04/2018 48 NaN 8
07/04/2018 NaN NaN NaN
08/04/2018 NaN 8 NaN
09/04/2018 NaN NaN NaN
what i want is
05/04/2018 15 54 87
06/04/2018 48 NaN 8
08/04/2018 NaN 8 NaN
hope you understand. !!! thanks in advance.

采纳的回答

Walter Roberson
Walter Roberson 2018-5-21
mask = all(isnan(YourArray),2);
YourArray(mask, :) = [];
  5 个评论
Ameer Hamza
Ameer Hamza 2018-5-21
@Walter's code given in comment should work. Although there is a little typo about the mismatch of parenthesis.
mask = all(isnan(YourArray(:,2:end)),2);
YourArray(mask, :) = [];
pruth
pruth 2018-5-21
yes, it works. I corrected that already. thank you :)

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 NaNs 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by