Created
March 4, 2015 09:03
-
-
Save shaybensasson/ee64de41b52fd83f3ec5 to your computer and use it in GitHub Desktop.
remove NaN columns or rows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% see http://www.mathworks.com/matlabcentral/answers/68510-remove-rows-or-cols-whose-elements-are-all-nan | |
out = A(:,any(~isnan(A))); % for columns | |
out = A(any(~isnan(A),2),:); %for rows |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment