function A=cm_total(start,finish,N)
%function A=cm_total(start,finish,N)
%   COPYRIGHT:  George D. Tsibidis(1) and Nektarios Tavernarakis(2)
%               (1) Institute of Electronic Structure and Laser 
%               (2) Institute of Molecular Biology and Biotechnology 
%               Foundation for Research and Technology-Hellas (FORTH)
%               January 2007
%
%
%This helkps to compute the CM of the total animal taking into account 
%the segments of the animal but leaving out the first one
%N: number of segments


cd ('DATA_SAVED')

for i=start:finish
    i
A=[];
    for n=2:N
    
        sk=load(['skeleton_' int2str(i) '_line=' int2str(n) '.txt']);
     A=[A,sk];   
    end
  aq=['skeleton_' int2str(i) '_total_point=' int2str(n) '.txt'];
  K2=[mean(A(1,:));mean(A(2,:))];
    save(aq,'K2','-ascii');  
  
end

cd ..