Right now I am working with a Matlab GUI that plots data from an external file. I have recently added in the default toolbar zoom feature. I have modified the zoom by having it take the new x limits of the graph that has been zoomed in on and setting these limits as the new time limits for a separate graph (a smith chart). The new limits are assigned during the actionpostcallback function. I have also created a pushbutton callback function that redraws the smith chart with the new x limits from when the zoom occurs. This function works perfectly when called on its own using the button. However, when I try calling this function during the actionpostcallback of the zoom I receive the error:
Warning: An error occurred during the mode callback.
> In uitools.uimode.fireActionPostCallback at 14
In zoom>local2DButtonUpFcn at 1346
In hgfeval at 63
In uitools.uimode.modeWindowButtonUpFcn at 46
In uitools.uimode.setCallbackFcn>localModeWindowButtonUpFcn at 54
All of these files are default Matlab files. Here is my code for the zoom function:
function toolbar_zoomin_OnCallback(hObject, eventdata, handles)
h = zoom(handles.del_pwr);
h = zoom(handles.gmag);
global newLim zoom_use;
newLim = get(evd.Axes,'XLim');
disp(sprintf('The new X-Limits are [%.2f %.2f].',newLim));
axis 'auto y';
pushbutton_redrawsmithchart_Callback(hObject, eventdata, handles)
This is the code for the redrawsmithchart function:
function pushbutton_redrawsmithchart_Callback(hObject, eventdata, handles)
global newLim zoom_use ;
PortList = handles.colheaders;
tstart = newLim(1);
tstop = newLim(2);
This function then continues through the process of plotting a smith chart in Matlab within the if statement. I have not included that process as it is lengthy and I do not believe it is causing the problem. I can post the rest of that code if it is needed.
I am not sure as to why the function redrawsmithchart would work on its own but would create errors when called in another fuction. Thank you for any help.