delete zero rows in a matrix

You could use:

Select[m,#!={0,0,0}&]

Where #!={0,0,0}& is a pure function that returns True for any list not equal to the list of three 0's.


This s/b considerably faster for large cases:

#[[Union[SparseArray[#]["NonzeroPositions"][[All, 1]]]]] &@array

and this is even faster:

Replace[#, ConstantArray[0, Length@#[[1]]] -> Sequence[], {1}] &@array

and about the same as latter:

DeleteCases[#, ConstantArray[0, Length@#[[1]]]]&@array

Try this:

m = {{1, 2, I}, {0, 0, 0}, {I, I, 3}, {2, 6, I}, {0, 0, 0}, {0, 0, 
0}, {1, 6, 4}, {0, 0, 0}, {1, 4, 5}};

DeleteCases[m, {0 ..}, Infinity]

$\left( \begin{array}{ccc} 1 & 2 & i \\ i & i & 3 \\ 2 & 6 & i \\ 1 & 6 & 4 \\ 1 & 4 & 5 \\ \end{array} \right)$