% calculates # of columns/rows for channel buttons on
% control panel of time series figure
function [ncol,nrow,staN]=NcolNrow(sta,ch_id);
[nchan,dum]=size(sta);
ncol=1;
staN=sta(1,:);
k1=1;
while k1<nchan,
for k2=k1+1:nchan
  s=(sta(k1,:)~=sta(k2,:));
  if sum(s)>0,
   ncol=ncol+1;
   staN=[staN;sta(k2,:)];
   k1=k2+1;
   break
  end
  k1=k2;
end
end
%%%%%%%%%%%%
[nsta,dum]=size(staN);
nrow=zeros(1,nsta);
for k1=1:nsta
 for k2=1:nchan
  if sta(k2,:)==staN(k1,:),nrow(k1)=nrow(k1)+1;end
 end
end
return
