function A=delzeros(mat) 

    B = sparse([]);
    S= size(mat);
    i=1;
    
    rows = find(mat(1:end,1));
    for j = rows'
        B(i,j)=1;
        i=i+1;
    end
    A = B*mat;