find nan and eliminate it in matrix
Show older comments
hi!
i wann explain may problem with an example:
% A=[1 2 3;5 4 6;nan nan nan]
to eleminate nan: A=(A(~isnan(A)));
i get this array:A=[1 2 3 5 4 6];
why not A=[1 2 3; 5 4 6]?
i know we could use reshape. is there any other method?
thanx
Accepted Answer
More Answers (1)
Walter Roberson
on 18 Nov 2012
0 votes
What do you want to have happen if the rows contain unequal number of nans? Do you want to delete the entire row if any member of the row contains a nan? Or only delete the row if it is all nan?
Categories
Find more on Creating and Concatenating 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!