title: Changing displayed string in MATLAB GUI edit box by changing value in another edit box
body: <p>Right now, I am working on a GUI that plots graphs based on user-input data. The user enters numbers using edit boxes and from there the plot is generated.</p>
  
  <p>I have two values, period and frequency, which mathematically I know are interdependent (p=1/f and vice-versa). I believe I have made it so that when I edit frequency, a new value for period is calculated, but what I also want to do is display the new value for period in the period edit box whenever the user types in a new value for frequency. To illustrate, here is the code that I have for the frequency edit box right now:</p>
  
  <pre><code>%period (ns)
  function edit11_Callback(hObject, eventdata, handles)
  num = str2double(get(hObject,'string'));
  %global edit10;%brings frequency to edit11 function
  %global edit11;%globalize period
  handles.edit11 = num;
  handles.edit10 = 1/num;%frequency = 1/period
  set(handles.edit10,'String',num2str(1/num));%displays new frequency
  guidata(hObject,handles)
  </code></pre>
  
  <p>note: edit10 is the edit box for period. I expect that the code for that one would just be a sort of reverse of what I have for frequency. Also, I commented out the 'global' lines because it doesn't seem that I need them for what I'm trying to do, but I did try that out.</p>
  
  <p>"handles.edit10 = 1/num;" updates the actual value for period. As far as I know, the last line (guidata(...)) will save the new values for handles.edit10 and handles.edit11 globally, but correct me if that's wrong, please.</p>
  
  <p>What doesn't work is the line: "set(handles.edit10,'String',num2str(1/num));", which is supposed to display the new value for period in the period edit box (edit10).</p>
  
  <p>The error message I get is as follows:</p>
  
  <pre><code>Error using handle.handle/set
  Invalid or deleted object.
  
  Error in Liposome_GUI&gt;edit11_Callback (line 367)
  set(handles.edit10,'String',num2str(1/num));%displays new frequency
  
  Error in gui_mainfcn (line 95)
      feval(varargin{:});
  
  Error in Liposome_GUI (line 42)
  gui_mainfcn(gui_State, varargin{:});
  
  Error in @(hObject,eventdata)Liposome_GUI('edit11_Callback',hObject,eventdata,guidata(hObject))
  
  
  Error while evaluating uicontrol Callback
  </code></pre>
  
  <p>The error message makes it seem like the function edit11 doesn't have access to the value stored in handles.edit10, but nothing seems to change if I put those two 'global' lines in under both the edit10 and edit11 functions.</p>
  
  <p>Can anybody tell me what I'm doing wrong?</p>