title: Controlling a matlab script (Pause, Reset)
body: <p>I am trying to create a matlab script (m-file) which shall be controlled by an external VBA script.</p>
  
  <p>The matlab script shall do the same operation every time (even params change, but this is not the matter in this case) for a certain number of loops.
  If I see it right, I can use matlab funktions in VBA like this: <a href="http://www.mathworks.de/help/techdoc/matlab_external/f135590.html#f133975" rel="nofollow noreferrer">http://www.mathworks.de/help/techdoc/matlab_external/f135590.html#f133975</a></p>
  
  <p>My main problem is how to implement the matlab part of this problem...at the moment my control part looks like this:</p>
  
  <p><strong>start.m:</strong></p>
  
  <pre><code>run = 1;
  reset = 0;
  while run ~= 0     % Loop until external reset of 'run' to '0'
      if reset ~= 0
          doReset();   % Reset the parameters for the processing
          reset = 0;
          disp('I did a reset');
      end
  
      disp('I am processing');
      doProcess();
      pause(1)
  end
  disp('I am done');
  </code></pre>
  
  <p>The reset part works very fine while changing the value by the script, but when I manually try to change the value of 'run' or 'reset' to any other value in my workspace, nothing happens...my script doen't abort, neither does the reset-if do it's work...
  this seems to me that the script doesn't recognize any changes in the workspace?!</p>
  
  <p>later the variables 'run' and 'reset' shall be set or unset by the VBA script.
  Is there any plausible reason why I can't abort the loop by hand?</p>
  
  <p>Thanks for any advice!</p>
  
  <p>greets, poeschlorn</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>It seems that the script loads the variables once before starting and never again during runtime...is there a possibility to have explicit access to a workspace variable?</p>
  
  <p><strong>Edit 2:</strong></p>
  
  <p>I use Matlab 2010b with no additional Toolboxes at the moment</p>
  
  <p><strong>Edit 3:</strong></p>
  
  <p>I found out, that there are several 'workspaces' or RAMs in Matlab. If my function is running, the variables are stored in 'base' (?) workspace, which is not the matlab workspace on which you can click and change every value. So I have to get access to this ominous 'base' space and change the flag 'run' to zero.</p>