I can't understand what I'm doing wrong here; basically I have two matrices, A and B, and if one of the two matrices has a row in which every entry is equal to NaN, I want to delete the corresponding row in the other matrix as well. This is the code I used:
A1 = A;B1 = B;for i = 1 : size(A,1) if sum(isnan(A(i,2:end)))==size(A(:,2:end),2) || ... sum(isnan(B(i,2:end)))==size(B(:,2:end),2); A1(i,:) = [] B1(i,:) = []; endend
However, in matrix B1 there are still many rows entirely made of NaN values. Why is this not working?
Best Answer