MATLAB Answers

Ngial
0

How to filter out rows with NaNs from one variable and the same rows from another variable without NaNs.

Asked by Ngial
on 24 Jul 2018
Latest activity Answered by Paolo
on 24 Jul 2018
I have a numerical variable X [506x24706] and a numerical variable Y [506x1]. Variable Y includes some NaNs. How can I filter out rows with NaNs from Y and at the same time filter out the same corresponding rows from X and create a new Y and a new X?

  0 Comments

Sign in to comment.

1 Answer

Answer by Paolo
on 24 Jul 2018

indx = isnan(Y);
Y(indx) = [];
X(indx,:) = [];

  0 Comments

Sign in to comment.