function nans = findnans(A)
%FINDNANS  find all NaN rows&cols
%
%   FINDNANS returns a vector with length size(A,1) that has a
%     1 if corresp. row and column is full of NaNs, 0 otherwise

%   We cannot simply look at the first column to pick out all the
%   NaN-rows as the first column might be an all-NaN one aswell...
%   So first keep looking for a column that is *not* all-NaN 
%   itselve and *then* find the NaN-rows...

temp = double(A);
temp(find(isnan(A))) = 42;
% if find(temp-temp')
% 	error('A must be symmetric !');
% end

step = 1;

while all(isnan(A(:,step))) % this column is all-NaN ...
	step = step + 1;         % check next one
	if step == size(A,1)+1   % if we reached the end ...
		error('No non-NaN row found !'); % the matrix was all-NaN
	end
end

nans = isnan(A(:,step));    % now return indices of NaN rows