MATLAB: Removing rows in matrix that contain zeros

dmlreadMATLABmatrix

Here is my code:
A = dmlread('B00001'.txt', '', 1,0)
for k=2:100;
A=A+dmlread(['B00',sprintf('%03d.txt',k)], '',1,0);
end
A=A/100
Right now it reads txt files B00001 to B00100, puts them in a matrix, and averages them to make a new matrix of the same size. But i need to remove the rows that contain zeros.

Best Answer

Try this:
rowsWithZeros = any(A == 0, 2);
A = A(~rowsWithZeros, :);