function Change_Number_of_Populations

multiple_population_handle = findobj('Tag','Fig_multiple_population');
number_of_populations_handle = findobj(multiple_population_handle,'Tag','EditText_number_of_populations');
populations_handle = findobj(multiple_population_handle,'Tag','PopupMenu_populations');
growth_rate_str_handle = findobj(multiple_population_handle,'Tag','StaticText_growth_rate');
morality_rate_str_handle = findobj(multiple_population_handle,'Tag','StaticText_morality_rate');
reproduction_rate_str_handle = findobj(multiple_population_handle,'Tag','StaticText_reproduction_rate');
probability_handle=findobj(multiple_population_handle,'Tag','EditText_Probability');

num_populations = get(number_of_populations_handle,'String');
parameters = get(multiple_population_handle,'UserData');

if (~isempty(num_populations))
   num_populations = str2num(num_populations);
   current_population = get(populations_handle,'Value');

   if(num_populations <= current_population)
      set(populations_handle,'Value',1);
      parameters{3} = parameters{3}(1:num_populations);
   else
      parameters{3}(num_populations) = struct('uo',[],'g',[],'m',[],'b',[],'c',[],'w',[],'gam',[]);      
   end   
   
   for i = 1:num_populations
      populations{i} = ['Population ',num2str(i)];
   end
   set(populations_handle,'String',populations);
   
   
   if(num_populations==1)
      set(growth_rate_str_handle,'String',['Growth Rate, g(x,P1)']);
      set(morality_rate_str_handle,'String',['Morality Rate, m(x,P1)']);
      set(reproduction_rate_str_handle,'String',['Reproduction Rate, b(x,P1)']);
   elseif (num_populations==2)
      set(growth_rate_str_handle,'String',['Growth Rate, g(x,P1,P2)']);
      set(morality_rate_str_handle,'String',['Morality Rate, m(x,P1,P2)']);
      set(reproduction_rate_str_handle,'String',['Reproduction Rate, b(x,P1,P2)']);
   else
      set(growth_rate_str_handle,'String',['Growth Rate, g(x,P1,...,P',num2str(num_populations),')']);
      set(morality_rate_str_handle,'String',['Morality Rate, m(x,P1,...,P',num2str(num_populations),')']);
      set(reproduction_rate_str_handle,'String',['Reproduction Rate, b(x,P1,...,P',num2str(num_populations),')']);
   end
   
   set(multiple_population_handle,'UserData',parameters);
   
end

   
   