MATLAB: Toggling Shift button in Calculator GUI

calculator guiMATLAB Compiler

I have been Understanding the Calculator already made in Matlab, I have seen that if we click on shift button first time then shift=1 and it remains 1 till we restart the program, So What I want that when I first time click on it, should set shift=1 and if I click again it Should set it to 0 e.g shift=0; I have Problem here
function pushbutton26_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton26 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global jj shift
shift=1;
Can Somebody let me know how can I toggle this button. All of the Files are available here at the following link.

Best Answer

This program has been created by GUIDE. This causes ugly names like "pushbutton26_Callback". The shift-status is most likely store in the global variable "shift".
Ugly function names accompanied with global variables and a poor documentation of the code are a bad programming style. I understand that GUIDE is responsible for this, but posting such code and asking others for changes hits a critical point: Any tiny change requires an exhaustive analysis of the code to avoid unwanted side-effects. A really professional advice would be: Do not modify foreign code if it has a low quality already.
It is possible, perhaps you have only change the last line from "shift=1" to "shift=1-shift". But it is tedious to check if this is correct, while it is easy to test if this is working appearently.