title: Matlab cannot recognize other UIControls of the same fig in callBack functions
body: <p>Here is the code for converting a decimal number to the target number system:</p>
  
  <pre><code>    hf = figure('Color', [1, 1, 0], 'Position', [400 400 600 400], ...
    'Name', 'Number System Conversion', 'NumberTitle', 'off', 'MenuBar', 'none');
      uicontrol(hf, 'Style', 'Text', 'Units', 'normalized', ...
    'Position', [0.05, 0.8, 0.45, 0.1], 'HorizontalAlignment', 'center', ...
    'String', 'Input', 'BackgroundColor', [0, 1, 1]);
      uicontrol(hf, 'Style', 'Text', 'Units', 'normalized', ...
    'Position', [0.5, 0.8, 0.45, 0.1], 'HorizontalAlignment', 'center', ...
    'String', 'Output', 'BackgroundColor', [0, 1, 1]);
      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      uiinput = uipanel(hf, 'Position', [0.04, 0.33, 0.45, 0.45], ...
    'Units', 'normalized', 'BackgroundColor', [1, 1, 0]);
      uicontrol('Parent', uiinput, 'Style', 'Text', 'Units', 'normalized', ...
    'Position', [0.1, 0.65, 0.25, 0.1], 'HorizontalAlignment', 'right', ...
    'String', 'Decimal', 'BackgroundColor', [1, 1, 0]);
      uicontrol('Parent', uiinput, 'Style', 'Text', 'Units', 'normalized', ...
    'Position', [0.1, 0.25, 0.25, 0.1], 'HorizontalAlignment', 'right', ...
    'String', 'Target Number System', 'BackgroundColor', [1, 1, 0]);
      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      he1 = uicontrol(hf, 'Style', 'Edit', 'Units', 'normalized', ...
    'Position', [0.25, 0.6, 0.2, 0.1], 'BackgroundColor', [0, 1, 0]);
      he2 = uicontrol(hf, 'Style', 'Edit', 'Units', 'normalized', ...
    'Position', [0.25, 0.4, 0.2, 0.1], 'BackgroundColor', [0, 1, 0]);
      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      uioutput = uipanel(hf, 'Units', 'normalized', ...
    'Position', [0.52, 0.33, 0.45, 0.45], 'BackgroundColor', [1, 1, 0]);
      uicontrol(uioutput, 'Style', 'Text', 'Units', 'normalized', ...
    'Position', [0.1, 0.5, 0.2, 0.1], 'HorizontalAlignment', 'left', ...
    'String', 'Result', 'BackgroundColor', [1, 1, 0]);
      ht = uicontrol('Parent', uioutput, 'Style', 'Text', 'Units', 'normalized', ...
    'Position', [0.4, 0.5, 0.4, 0.1], 'HorizontalAlignment', 'center', 'BackgroundColor', [0, 1, 0]);
      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      uicontrol(hf, 'Style', 'pushbutton', 'Units', 'normalized', ...
    'Position', [0.18, 0.1, 0.2, 0.12], 'String', 'Convert', 'CallBack', @callBackFun);
      uicontrol(hf, 'Style', 'pushbutton', 'Units', 'normalized', ...
    'Position', [0.65, 0.1, 0.2, 0.12], 'String', 'Exit', 'CallBack', 'close(hf)');
      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      function callBackFun(src, event)
          n = str2num(get(he1, 'String'));
          b = str2num(get(he2, 'String'));
          if b &gt;= 10
              warndlg('Target system cannot be larger than 10!', 'Warning');
              set(he2, 'String', '');
          else
              set(ht, 'String', num2str(NumSysConv(n, b)));
          end
      end
      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      function NumSysConv = NumSysConv(n, b)
          ch1 = '0123456789';
          k = 1;
          while n ~= 0
              p(k) = rem(n, b);
              n = fix(n/b);
              k = k + 1;
          end
          k = k - 1;
          strdec = '';
          while k &gt;= 1
              kb = p(k);
              strdec = strcat(strdec, ch1(kb + 1: kb + 1));
              k = k - 1;
          end
          NumSysConv = strdec;
      end
  </code></pre>
  
  <p>The problem is in the second from last uicontrol whose callback function is @CallBackFun, in which I want to read and set properties of other uicontrols in the same piece of code, however it renders out the error message: "Undefined function or variable 'he1'.", which means it cannot recognize the uicontrols in the same fig, how to solve this issue? Thanks in advance!</p>