title: Matlab timer undefined function or variable
body: <p>I have a question about matlab timer object. I have a button in my gui that creates a timer and every period of 0.1 i want to call my function.</p>
  
  <pre><code>function playBtn_Callback(hObject, eventdata, handles)
  global pl;
  global c;
  global g;
  global t;
  global myData;
  if isplaying(pl)
       pause(pl);
       set(handles.playBtn, 'string', 'Play');
  else 
       resume(pl);
       set(handles.playBtn, 'string', 'Pause');
  end
  myData=guidata(handles.timertext);
  c=get(pl, 'CurrentSample')
  g=get(pl, 'TotalSample')
  a = timer;
  set(a, 'ExecutionMode', 'FixedRate');
  set(a, 'TimerFcn', 'myFunction', 'Period', 0.1);
  start(a);
  
  
  
  function t = myFunction()
  global mydata;
  global pl;
  global sf;
  global mySong;
  
  c=get(pl, 'CurrentSample')
  set(mydata.timertext, 'String', c/sf);
  </code></pre>
  
  <p>sf is the frequency of my song.</p>
  
  <p>The error i get is this:</p>
  
  <p>Error while evaluating TimerFcn for timer 'timer-26' </p>
  
  <p>Undefined function or variable 'myFunction'.</p>