I have found a work around for this bug. By using a while loop and the uiwait, uiresume commands I was able to get the graphs to redraw after the zoom event. Here is the fix to my code:
% --------------------------------------------------------------------
function toolbar_zoomin_OnCallback(hObject, eventdata, handles)
% hObject handle to toolbar_zoomin (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global zoom_use current_object stop_updating;
zoom_use=0;
stop_updating = 0;
h = zoom(handles.del_pwr);
h = zoom(handles.gmag);
set(h,'ActionPostCallback',@mypostcallback);
set(h,'Enable','on');
current_object = gcf;
while zoom_use ==0
uiwait(gcf);
pushbutton_redrawsmithchart_Callback(hObject, eventdata, handles)
if stop_updating == 1
break;
end
end
% ----occurs after mouse button up for zoom function
function mypostcallback(obj,evd)
global newLim zoom_use current_object;
newLim = get(evd.Axes,'XLim');
disp(sprintf('The new X-Limits are [%.2f %.2f].',newLim));
zoom_use=1;
axis 'auto y';
disp(zoom_use);
uiresume(current_object);
% --------------------------------------------------------------------
function toolbar_zoomin_OffCallback(hObject, eventdata, handles)
% hObject handle to toolbar_zoomin (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global stop_updating;
zoom off;
stop_updating = 1;
In addition, in the last line of my redrawsmithchart function I have put the line:
zoom_use= 0;
to reset for the while loop.
There are probably more efficient ways of solving this but none that I can come up with. This also doesn't answer my original question of why I was receiving the error described above.