function p = extractb(a)
% p = extractb(a)
%     Returns a list of locations (start,stop) of bands: (i1,j1,j2)
[m n] = size(a);
index = 0;
for ii = 1:m
  jj = 0;
  while jj<n
    jj = jj+1;
    if a(ii,jj) > 0
      index = index+1;
      p(index,1) = ii;
      p(index,2) = jj;
      val = a(ii,jj);
      j2 = jj+1;
      while j2<n & a(ii,j2) == val
        j2 = j2+1;
      end
      p(index,3) = j2-1;
      jj = j2;
    end
  end
end
