I assume you want to remove rows/planes containing only zeros. To find these, you can use
This searches for all planes where all entries along the first and third dimension are equal to zero.
To remove all those rows/planes, you can directly index A via this expression:
A(:,all(A==0, [1 3]),:) = 
I hope this helps!