title: When a user enters text through Uicontrol edit, how should I save it to a variable?
body: <pre class="lang-matlab prettyprint-override"><code>function main    
      handles.fig = figure(&quot;units&quot;, &quot;pixels&quot;, &quot;visible&quot;, &quot;off&quot;);
      handles.edit = uicontrol(handles.fig, &quot;style&quot;, &quot;edit&quot;, &quot;max&quot;, 2,  &quot;min&quot;, 0);
      set(handles.edit, &quot;string&quot;, &quot;t=[0:0.01:1] x=t y=x.^2 f=z.^2&quot;, &quot;position&quot;, [350 80 150 
      220], &quot;horizontalalignment&quot;, &quot;left&quot;);
      set(handles.edit, &quot;callback&quot;, {@edit, handles});
  end
  
  function edit(s, data, handles)
    text = get(s, &quot;string&quot;);
    [numberline numberchar] = size(text);
    for i = 1 : numberline
      eval(text{i,:});
  
    endfor
    
     
  end
  </code></pre>
  <p>This is my current code. I thought it would be possible if I erased for from function &quot;edit&quot; and wrote it down like &quot;a = text{1,:}&quot;. However, it is not stored as a variable.
  :(</p>