title: Matlab makes the loops run simultaneously
body: <p>Unfortunately, I have two loops. that's why my code makes the first loop run and only when it is finished, it makes the second loop run.</p>
  
  <p>But I want the gui to show the data simultaneously: in the hAxes and in the loading1.</p>
  
  <p>How can I make it?</p>
  
  <pre><code>hFigure = figure('units','pixels','position',[300 300 424 470],'menubar','none',...
  'name','start processing','numbertitle','off','resize','off');        
  
  hAxes = axes('Parent',hFigure,'Units','pixels','Position',[0 112 424 359]); 
  
  loading1 = uicontrol('style','text','unit','pix','position',[0 72 424 40],...
  'backgroundcolor','r','fontsize',20);
  
  %% shows the data on hAxes
  for i = 5:100
      if mod(i,2) == 0
          set(hAxes,'Color','b');
      else
          set(hAxes,'Color','g');
      end
      drawnow;
  end
  
  %% shows the data on loading1
  for i=1:200
      image2 = horzcat('now processing ', 'image', num2str(i), '.jpg of 200 images');
      set(loading1,'string',image2);
      drawnow;
  end
  </code></pre>
  
  <p>this code is of Peter:</p>
  
  <pre><code>    function test1
  
      hFigure = figure('units','pixels','position',[300 300 424 470],'menubar','none','name','start processing','numbertitle','off','resize','off'); 
  
      % Your other setup calls
      hAxes = axes('Parent',hFigure,'Units','pixels','Position',[0 112 424 359]); 
  
      loading1 = uicontrol('style','text','unit','pix','position',[0 72 424 40],'backgroundcolor','r','fontsize',20);
  
      c = 1;
      t = timer('TimerFcn', @color_change_fcn,'StartDelay',1.0);
      start(t);
  
      for i=1:200
          image2 = horzcat('now processing ', 'image', num2str(i), '.jpg of 200 images');
          set(loading1,'string',image2);
          drawnow;
      end
  
      function color_change_fcn
          if mod(c,2) == 0
              set(hAxes,'Color','b');
          else
              set(hAxes,'Color','g');
          end
          drawnow;
          c = c + 1;
      end
  end
  </code></pre>
  
  <p>It doesn't work (doesn't show the hAxes). I saw it doesn't make the color_change_fcn run (I tried to write: disp('test') in the first row of color_change_fcn function, but it prints nothing.</p>