📄 jisuanqi.m
字号:
if strcmp(IsStart,'true')==1
temp=get(handles.text2,'String');
if strcmp(temp,'0')~=1
if strcmp(IsNew,'true')==1
set(handles.text2,'String','0');
IsNew='false';
else
num=strcat(get(handles.text2,'String'),'0');
set(handles.text2,'String',num);
end
end
end% --- Executes on button press in pushbutton22.
%按键正负号+/-function pushbutton22_Callback(hObject, eventdata, handles)% hObject handle to pushbutton22 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
global IsStart;
if strcmp(IsStart,'true')==1
temp=get(handles.text2,'String');
if temp(1:1)=='-'
temp=temp(2:end)
set(handles.text2,'String',temp);
else
temp=0-str2num(temp);
set(handles.text2,'String',num2str(temp));
end
end
% --- Executes on button press in pushbutton23.
%按键 。小数点function pushbutton23_Callback(hObject, eventdata, handles)% hObject handle to pushbutton23 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)global IsStart;
if strcmp(IsStart,'true')==1
temp=get(handles.text2,'String');
if find(temp=='.')>0
;
else
temp=strcat(temp,'.');
set(handles.text2,'String',temp);
end
end% --- Executes on button press in pushbutton24.
%按键closefunction pushbutton24_Callback(hObject, eventdata, handles)% hObject handle to pushbutton24 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
set(handles.text2,'string','');
% --- Executes on button press in pushbutton29.
%按键加号+function pushbutton29_Callback(hObject, eventdata, handles)% hObject handle to pushbutton29 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
global Number1;% --- 操作数1
global Number2;% --- 操作数2
global opvalue;% --- 运算符
global IsNew;% --- 操作数新得开始
global IsStart;
if strcmp(IsStart,'true')==1
if strcmp(Number1,'')~=1
Number2=str2num(get(handles.text2,'String'));
Number1=calculate(Number1,Number2,opvalue);
set(handles.text2,'String',num2str(Number1));
opvalue='+';
Number2='';
else
opvalue='+';
Number1=str2num(get(handles.text2,'String'));
end
IsNew='true';
end% --- Executes on button press in pushbutton30.
%按键减号-function pushbutton30_Callback(hObject, eventdata, handles)% hObject handle to pushbutton30 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)global Number1;% --- 操作数1
global Number2;% --- 操作数2
global opvalue;% --- 运算符
global IsNew;% --- 操作数新得开始
global IsStart;
if strcmp(IsStart,'true')==1
if strcmp(Number1,'')~=1
Number2=str2num(get(handles.text2,'String'));
Number1=calculate(Number1,Number2,opvalue);
set(handles.text2,'String',num2str(Number1));
opvalue='-';
Number2='';
else
opvalue='-';
Number1=str2num(get(handles.text2,'String'));
end
IsNew='true';
end% --- Executes on button press in pushbutton31.
%按键乘号*function pushbutton31_Callback(hObject, eventdata, handles)% hObject handle to pushbutton31 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
global Number1;% --- 操作数1
global Number2;% --- 操作数2
global opvalue;% --- 运算符
global IsNew;% --- 操作数新得开始
global IsStart;
if strcmp(IsStart,'true')==1
if strcmp(Number1,'')~=1
Number2=str2num(get(handles.text2,'String'));
Number1=calculate(Number1,Number2,opvalue);
set(handles.text2,'String',num2str(Number1));
opvalue='*';
Number2='';
else
opvalue='*';
Number1=str2num(get(handles.text2,'String'));
end
IsNew='true';
end% --- Executes on button press in pushbutton32.
%按键除号/function pushbutton32_Callback(hObject, eventdata, handles)% hObject handle to pushbutton32 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
global Number1;% --- 操作数1
global Number2;% --- 操作数2
global opvalue;% --- 运算符
global IsNew;% --- 操作数新得开始
global IsStart;
if strcmp(IsStart,'true')==1
if strcmp(Number1,'')~=1
Number2=str2num(get(handles.text2,'String'));
Number1=calculate(Number1,Number2,opvalue);
set(handles.text2,'String',num2str(Number1));
opvalue='/';
Number2='';
else
opvalue='/';
Number1=str2num(get(handles.text2,'String'));
end
IsNew='true';
end% --- Executes on button press in pushbutton33.
%按键开方sqrtfunction pushbutton33_Callback(hObject, eventdata, handles)% hObject handle to pushbutton33 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
global Number1;% --- 操作数1
global Number2;% --- 操作数2
global opvalue;% --- 运算符
global IsNew;% --- 操作数新得开始
global IsStart;
if strcmp(IsStart,'true')==1
temp=str2num(get(handles.text2,'String'));
if temp~=0
sqrt(temp)
set(handles.text2,'String',num2str( sqrt(temp)));
Number1='';
Number2='';
end
IsNew='true';
end % --- Executes on button press in pushbutton34.
%按键取对数logfunction pushbutton34_Callback(hObject, eventdata, handles)% hObject handle to pushbutton34 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
global Number1;% --- 操作数1
global Number2;% --- 操作数2
global opvalue;% --- 运算符
global IsNew;% --- 操作数新得开始
global IsStart;
if strcmp(IsStart,'true')==1
if strcmp(Number1,'')~=1
Number2=str2num(get(handles.text2,'String'));
Number1=calculate(Number1,Number2,opvalue);
set(handles.text2,'String',num2str(Number1));
opvalue='log';
Number2='';
else
opvalue='log';
Number1=str2num(get(handles.text2,'String'));
end
IsNew='true';
end% --- Executes on button press in pushbutton35.
%按键求幂^function pushbutton35_Callback(hObject, eventdata, handles)% hObject handle to pushbutton35 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
global Number1;% --- 操作数1
global Number2;% --- 操作数2
global opvalue;% --- 运算符
global IsNew;% --- 操作数新得开始
global IsStart;
if strcmp(IsStart,'true')==1
if strcmp(Number1,'')~=1
Number2=str2num(get(handles.text2,'String'));
Number1=calculate(Number1,Number2,opvalue);
set(handles.text2,'String',num2str(Number1));
opvalue='^';
Number2='';
else
opvalue='^';
Number1=str2num(get(handles.text2,'String'));
end
IsNew='true';
end
% --- Executes on button press in pushbutton36.
%按键回退←function pushbutton36_Callback(hObject, eventdata, handles)% hObject handle to pushbutton36 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
global IsNew;% --- 操作数新得开始
global IsStart;
if strcmp(IsStart,'true')==1
temp=get(handles.text2,'String');
if strcmp(temp,'0')~=1
if(max(size(temp))==1)
set(handles.text2,'String',0);
IsNew='true';
else
set(handles.text2,'String',temp(1:end-1));
end
else
set(handles.text2,'String',0);
IsNew='false';
end
end %按键=% --- Executes on button press in pushbutton39.function pushbutton39_Callback(hObject, eventdata, handles)% hObject handle to pushbutton39 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)global Number1;
global Number2;
global opvalue;
global IsStart;
if strcmp(IsStart,'true')==1
if strcmp(Number1,'')~=1
Number2=str2num(get(handles.text2,'String'));
Number1=calculate(Number1,Number2,opvalue);
set(handles.text2,'String',num2str(Number1));
Number1='';
Number2='';
IsNew='true';
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -