delete the whole row ?

1 view (last 30 days)
pruth
pruth on 21 May 2018
Edited: pruth on 21 May 2018
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.

Accepted Answer

Walter Roberson
Walter Roberson on 21 May 2018
mask = all(isnan(YourArray),2);
YourArray(mask, :) = [];
  5 Comments
Ameer Hamza
Ameer Hamza on 21 May 2018
@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 on 21 May 2018
yes, it works. I corrected that already. thank you :)

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!