How to find row/column indices having all values NaN?

22 views (last 30 days)
I have a Matrix, where few rows/columns have NaN value corresponding to all the columns/rows respectively. I know how to remove these rows/columns: X=X(:,~all(is an(X))); But I want to know the indices of these rows/columns.
Can anyone please help me?

Accepted Answer

Honglei Chen
Honglei Chen on 25 May 2017
If x is your matrix, do you mean
find(all(isnan(x),2))
or
find(all(isnan(x),1))
HTH

More Answers (0)

Categories

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!