function prot_men(nb_stage)

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

global dim_protoc protocole liste_stim liste_disc
global dim_x dim_y

n=5;
labels=['nb steps          ';
        'period stim       ';
        'cells stimulated  ' ;
	'cells disconnected';
	'amp. stim         '];




unit=['nb    ';
      'nb    ';
      'stimul';
      'discon';
      'nb    '];



H0=.05; L0=.3;
% Hauteur champ, largeur edit, largeur 
nom=['stage' int2str(nb_stage)];
labelh_fig = figure('unit','norm','pos', [.5 .1 L0, min([(n + 1) * H0 .95])],...
		 'numbertitle', 'off', 'name',nom,'userdata',nb_stage);

H = 1/(n+1); LE = .33; LL = .33;
for i = 1:3
  id=i;if(id==3)id=5;end;
  posy = H + (n - i) * H;
  uicontrol('unit','norm','pos', [  0     posy  LL H], 'style', 'text', 'string',...
    labels(id, :));
  val = num2str(protocole(id,nb_stage));
  nom=['protocole(' int2str(id) ',' int2str(nb_stage) ')'];
  uicontrol('unit','norm','pos', [  LL    posy  LE H], 'style', 'edit', 'string',...
  val, 'userdata', nom,'call',...
  ['x=str2num(get(gco,''string''));a=get(gco,''userdata'');'...
   'eval([ a ''=x;'']);']);
  uicontrol('unit','norm','pos', [LL + LE posy  LL H], 'style', 'text', 'string', ...
  unit(id,:));
end


for i = 4:5
  id=i-1;
  posy = H + (n - i) * H;
  uicontrol('unit','norm','pos', [  0     posy  LL+.6*LE H], 'style', 'text', 'string',...
    labels(id, :));
  val = num2str(protocole(id,nb_stage));
  nom=['protocole(' int2str(id) ',' int2str(nb_stage) ')'];
  uicontrol('unit','norm','pos', [LL+.4*LE  posy  .6* LE H], 'style', 'text', 'string', val, 'userdata', nom);

uicontrol('unit','norm','pos', [LL + LE posy  LL H], 'style', 'pushbutton', 'string', ...
unit(id,:),'min',0,'max',1,'call',['if(isempty(dim_x))dim_x=10;end;',...
				     'if(isempty(dim_y))dim_y=10;end;',...
				     'mat_in=ones(dim_x,dim_y);',...
			             'tache=get(gco,''string'');',...
				     'etape=get(gcf,''userdata'');',...
				     'id=3;if(strcmp(tache(1:4),''disc''))id=4;end;',...
				     'cible=eval([''liste_'' tache(1:4)]);',...
				      'if(~isempty(cible))',...
				     'ii=find(cible(3,:)== etape & cible(1,:) <= dim_x & cible(2,:) <= dim_y);',...
				     'if(~isempty(ii))',...
				      'for j=1:length(ii)',...
				      'mat_in(cible(1,ii(j)),cible(2,ii(j)))=0;',...
				      'end; end;end;',...
				      'ed_res(mat_in,2,id-2,etape)']);


end


posy = 0;
uicontrol('unit','norm','pos', [0, posy, 2 * LL + LE,  H], 'style', 'pushbutton', 'string', 'OK',...
	  'call', 'delete(gcf)');
