title: run a batch file and a waitbar in matlab parallel
body: <p>I'd like to count my waitbar as long as the batch file is running. </p>
  
  <p>Trials:</p>
  
  <ul>
  <li><code>[status cmdout] = dos('test.bat &amp;');  %the waitbar didn't know when the batch file ends.</code></li>
  <li><code>[status cmdout] = dos('test.bat');  %the waitbar starts after the batch file ends</code></li>
  <li><p>With a function in which 1 is to run the batch file and 2 is the waitbar. The problem is, there's no possibility to display something in matpool.</p>
  
  <pre><code>matlabpool(2)
      parfor i=1:2
         parallel_work(i);
      end
  matlabpool close
  </code></pre></li>
  </ul>
  
  <hr>
  
  <pre><code>h = waitbar(0,'Initializing waitbar...');
  t = timer('TimerFcn', 'stat=false;','StartDelay',180);
  start(t)
  stat=true;
  cnt = 0;
  while(status==false)
    perc = round(58+(42/180)*5*cnt);
    waitbar(perc/100,h,sprintf('%d%% ...',perc));
    pause(5)
    cnt = cnt + 1;
  end
  </code></pre>