MATLAB: How to resize the matrix

resizing the matrices

Hello, Let's say I have the matrix as below:
A= [0 0 0 0 0;0 0 0 0 0;2 3 9 1 7;4 5 6 5 4;0 0 0 0 0] (It can be in different size too)
I want have:
B=[2 3 9 1 7; 4 5 6 5 4] out of A
How can I do that? Thx

Best Answer

B = A(sum(A') ~= 0, :)