MATLAB: How to find zeros of a matrix

matrix

I learn me better
for example, given A
A=[1 2 3 0 0 5; 8 0 3 0 9 9]
I want a vector which contains the extrems of these zeros:
v=[3 5; 8 3; 3 9];
thanks

Best Answer

A = [1,2,3,0,0,5;8,0,3,0,9,9];
AA = A';
AA = AA(:)';
lo = AA ~= 0;
out = AA([strfind(lo, [1 0]);strfind(lo, [0 1])+1]');