I have been trying to create a MATLAB GUI using Guide which :
i) has a function that takes in input parameters (Temperature, Superconducting Gap Energy, Broadening Parameter) and outputs a plot - a Density of States plot showing a superconducting energy gap.
Note: This function involves numerical double integration, so the parameters can not be varied in a straightforward manner by using sliders. To study the variation in the curve from different parameters, each time the new parameters are input, the function double integrates again and a new curve is generated within the same axes.
ii) The GUI has 4 sets of input fields so that 4 curves can be plotted within the same axes at at a given time for comparison.
I used the following code:
handles.P1=plot(handles.dIdV,bias1,cond1,'r','linewidth',2);
%P1 = plot(handles.dIdV,bias1,cond1,'r','linewidth',2);
hold on
%plot(x,data(:,2),'b','linewidth',2)
%scatter(E,XDOS)
%xlim([min(bias) max(bias)])
%title(nem)
(Kindly do not get confused by the comments. 'cond1' is the result of integration for set1 of parameters, this is plotted against the array 'bias'. Thus the DOS (function of bias, temperature, delta-gap value, etc) is integrated up to each 'bias' value and stored in 'cond1', which is then plotted against that 'bias' value. )
to clear this, I wrote:
% --- Executes on button press in clear1.
function clear1_Callback(hObject, eventdata, handles)
% hObject handle to clear1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles.temp1=0;
handles.delta1=0;
handles.tao1=0;
handles.vmod1=0;
handles.val1=0;
hold off
i.e. all the parameters are reset to zero and hold function is turned off.
The same bit of code has been written 4 times for 4 different curves. So each curve has a hold function when the plot command is given and when the clear button is pressed, the 'hold' is supposed to turn off. e.g. Curve1 is generated using parameterset1. Pressing the clear1 button should turn hold off for curve1 so that new values can be put in parameterset1 and a new curve1 can be plotted on same axes as curve2, curve3 and curve4, without affecting these other curves.
There is a problem with the execution of the 'hold on' and 'hold off' lines in that I cannot delete one curve at a time and replace it with a new one.
The moment I enter new parameters into any of the handles, all the other plots disappear.
Where could I be going wrong? Is it possible to replace one curve at a time in a single axis with hold on in MATLAB?
Thanks a lot.