title: Resetting timer in Matlab GUI after button push
body: <p>So I made a GUI using AppDesigner where it look like:</p>
  
  <p><a href="https://i.stack.imgur.com/Jv6u1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Jv6u1.png" alt="enter image description here"></a></p>
  
  <p>And the two white boxes are actual the UITextArea elements of the App Designer. Above is when the app has executed, the timer starts counting down and showing the time on the UITextArea. The code i used for the timer is as below:</p>
  
  <pre><code>methods (Access = private)
  
      function countdown(app)
          while true
              try
                  minute = 29;
                  set(app.TextArea1, 'Value', num2str(minute));
                  seconds = 0;
                  set(app.TextArea2, 'Value', num2str(seconds));
                  while minute &gt; 0
                      seconds = 59;
                      while seconds &gt; 0
                          set(app.TextArea2, 'Value', num2str(seconds));
                          pause(1);
                          seconds = seconds - 1;
                      end
                      minute = minute - 1;
                      set(app.TextArea1, 'Value', num2str(minute));
                  end
              catch
                  break;
              end
          end
      end
  </code></pre>
  
  <p>And since i want the timer to start ticking at startup, i called the function at startup:</p>
  
  <pre><code>function startupFcn(app)    
          app.countdown;
  end
  </code></pre>
  
  <p>However, the problem I'm having now is that i have this button, upon pushing it, i would want the timer to reset back to it's original value and start ticking down again. </p>
  
  <pre><code>function ResetButtonPushed(app, event)
      app.countdown
      %other process executes here onwards.
      .
      .
  end
  </code></pre>
  
  <p>But the problem is that, i want other process which comes after calling app.countdown to continue, where in my case, the program waits for app.countdown to finish executing before moving to the next line. Is there a workaround for this?</p>