
function [No,Noo] = count(X)

nx = max(max(X)); % number of output labels

[L,n] = size(X);

No = zeros(1,nx);
Noo= zeros(nx,nx);

for i=1:nx, 
  No(i) = length(find(X(:,1)==i)); 
  for j=1:nx,
    Noo(i,j) = length(find(X(:,1:n-1)==i & X(:,2:n)==j));
  end;
end;
