function [freq]=findLevelFreq(level);
% findLevelFreq is used to find the distribution of aa over levels 
% Program by Steinar Thorvaldsen, steinart@math.uit.no, Mars. 2006. 
% Last changes 21. Mars 2006.

% Use:     [distribution]=findLevelFreq(level);

% Input
% level:    Vector containin information on 2D or 3D about the aligned sequences. 

% Output
% freq:     The distribution over different levels.

D3=max(level); % the number of layers
freq=zeros(1,D3);
for n=1:D3
  level_index = find(level==n);
  freq(n)=length(level_index);
end
