title: MATLAB uicontrol callback function handle output
body: <p>This is a basic question, but I am having a hard time with it. </p>
  
  <p>Basically, I have a callback-function assigned to the choices in a pop-up menu on a GUI. The code is as follows:</p>
  
  <pre><code>uicontrol(mainfigure, 'Style', 'popup',...
      'String', 'A|B|C',...
      'Position',[850 190 200 30],...
      'Callback', @blockset);
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
  function [block] = blockset(hObj,evnt) %#ok&lt;INUSD&gt;
  
  blockval = get(hObj,'Value');
  
  if blockval == 1
     block = 'A';
  elseif blockval == 2
     block = 'B';
  elseif blockval == 3
     block = 'C';
  end
  
  end
  </code></pre>
  
  <p>As you can see, it is simply assigning a string value to the different choices in the pop-up menu. I want to use these strings as input values to another function later in the script (which is also embedded in a uicontrol callback):</p>
  
  <pre><code>uicontrol(mainscreen, 'Style', 'pushbutton',...
      'Position',[855 300 150 50],...
      'String', 'START',...
      'FontSize',10,'FontWeight','bold',...
      'BackgroundColor', [.9 .9 .9],...
      'CallBack', {@START_Callback, block});
  </code></pre>
  
  <p>The code as is doesn't work. But I can't figure out how to define the outputs for a uicontrol callback. I already defined "block" as the output for the blockset function, so how do I get the START_Callback to recognize it as input? Every time I try, it just tells me that "block" is an undefined function or variable.</p>
  
  <p>Is there something I need to do with the " 'Callback', @blockset " line of code to get it to recognize the output from the function?</p>
  
  <p>EDIT: Some cursory internet searching indicates that I probably have to use something like setappdata/getappdata, or another workaround method. However, I don't entirely understand the documentation on those. How do I use them in this situation?</p>