title: Changing slope of 2 lines on same plot with 2 separate sliders in Matlab
body: <p>newish Matlab coder here seeking advice on my first GUI. I'm building a simple GUI that plots 2 lines on the same graph (axes1) and I'm trying to utilize sliders to change the slope of each line independently to the value of the slider it is associated with. I have created the plot, and am able to change the slope of each line using slider callbacks; however, when I change the slope of line-2 after having changed the slope of line-1, the slope value of line-1 reverts back to its initial so the graph plots the changing line-2 slope with the line-1 slope remaining at its initial value. The same occurs to line-2 when trying to change the slope of line-1.</p>
  
  <pre><code>     function slider1_Callback(hObject, eventdata, handles)
       % hObject    handle to slider1 (see GCBO)
       % eventdata  reserved - to be defined in a future version of MATLAB
       % handles    structure with handles and user data (see GUIDATA)
       handles.gNa = get(hObject,'Value')
       plot_axes1(hObject, eventdata, handles);
       end
  
       function slider3_Callback(hObject, eventdata, handles)
       % hObject    handle to slider3 (see GCBO)
       % eventdata  reserved - to be defined in a future version of MATLAB
       % handles    structure with handles and user data (see GUIDATA)
       handles.gK = get(hObject,'Value')
       plot_axes1(hObject, eventdata, handles);
       end
  
       function plot_axes1(hObject, eventdata, handles);
       Vk = -77;
       Vna = 50;
       V = (-80:0.1:60);
       Ik = handles.gK*(V - Vk);
       Ina = handles.gNa*(V - Vna);
       axes(handles.axes1);
       plot(V, Ik, V, Ina);
       end
  </code></pre>
  
  <p>Also, When handles.gK or handles.gNa prints (when either the slider callbacks occur), it prints the initial values of the handle variable opposite to the one being changed via the slider.</p>
  
  <p>I have followed the guidance of others and instituted a separate plotting function, which is called by each sliders' callback function but can't seem to get the slope values to remain at the slider value. Any help on how to retain the slope of each line while the other is being altered would be greatly appreciated. Thanks!</p>