function lkdchang(tag)

%   Copyright 2003
%   Centre for Nonlinear Dynamics in Physiology and Medicine

global nb_state_ex nb_state_arp
global dim_x dim_y
global etat
global threshold
global dim_protoc protocole


%linked changes

% number of state and threshold

if(strcmp(tag,'nb_state_ex ') | strcmp(tag,'nb_state_arp'))

  if(length(threshold) < nb_state_ex+nb_state_arp+1)
    threshold=[threshold;zeros(nb_state_ex+nb_state_arp+1-length(threshold),1)];

  elseif(length(threshold) > nb_state_ex+nb_state_arp+1)

    threshold=threshold(1:nb_state_ex+nb_state_arp+1);

   end;
 map=hot(nb_state_ex+nb_state_arp+1);
 colormap(map);

elseif(strcmp(tag,'dim_x') | strcmp(tag,'dim_y'))
   a=size(etat);

   if(a(1) ~= dim_x | a(2) ~= dim_y)
   etat=zeros(dim_x,dim_y);
   end;



elseif(strcmp(tag,'dim_protoc'))


  if(isempty(protocole))
      protocole=zeros(5,dim_protoc);
      protocole(1,1)=1;
  elseif(length(protocole(1,:)) < dim_protoc)
   protocole=[protocole zeros(5,dim_protoc-length(protocole(1,:)))];
  elseif(length(protocole(1,:)) > dim_protoc)
    protocole=protocole(:,1: dim_protoc);
   end;

end;






