title: Changing the Value of a Variable While the Code is Running
body: <p>I'm writing a code that will take the location of the cursor and output a sound signal. But here's the catch: There is already a sin function playing in the background, the mouse click will merely change the x and y values of this sound. Here is what I came up with so far:</p>
  
  <pre><code>clear all
  clc
  k = 1:1200;
   k = k/5000;
  
   x=1;
   y=1;
  
  while i&lt;10;
      [x,y]=ginput(1)
  
   vib= 0.5*sin(2*pi*y*k);
   note=sin(pi*x*k*440);
   ses = note+vib;
   sound (ses);
   end
  </code></pre>
  
  <p>As you can see my code just plays a sin function but it is discrete. Can someone please help me? I researched handles and callbacks but I just can't get it in my head. The explanations that I find in the net are too complicated for me to understand. </p>