title: Passing actual values to callback function in Matlab
body: <p>let's assume the following easy example:</p>
  
  <pre><code>f = figure;
  plot(-10:10, (-10:10).^3, '*-r');
  x = 1;
  y = 1;
  set(f, 'ResizeFcn', {@resizeCallback2, x, y});
  
  while 1
      [x, y, button] = ginput(1);
      if(button ~= 1)
          break;
      end
  
      set(f, 'ResizeFcn', {@resizeCallback2, x, y});
  end
  
  %%--------------------------
  function resizeCallback2(hFig, ~, foo, bar)    
      foo
      bar
  end
  </code></pre>
  
  <p>Is there any easier way to always pass the <em>ACTUAL</em>* values for x and y to the callback function instead of having to always update it in the loop?
  Thanks!</p>