📄 jsq.m
字号:
function varargout = jsq(varargin)
% JSQ M-file for jsq.fig
% JSQ, by itself, creates a new JSQ or raises the existing
% singleton*.
%
% H = JSQ returns the handle to a new JSQ or the handle to
% the existing singleton*.
%
% JSQ('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in JSQ.M with the given input arguments.
%
% JSQ('Property','Value',...) creates a new JSQ or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before jsq_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to jsq_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help jsq
% Last Modified by GUIDE v2.5 08-Nov-2008 16:47:27
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @jsq_OpeningFcn, ...
'gui_OutputFcn', @jsq_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin & isstr(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before jsq is made visible.
function jsq_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to jsq (see VARARGIN)
% Choose default command line output for jsq
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes jsq wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = jsq_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes during object creation, after setting all properties.function editDisplay_CreateFcn(hObject, eventdata, handles)% hObject handle to editDisplay (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction editDisplay_Callback(hObject, eventdata, handles)% hObject handle to editDisplay (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of editDisplay as text% str2double(get(hObject,'String')) returns contents of editDisplay as a double
% --- Executes on button press in btn0.function btn0_Callback(hObject, eventdata, handles)% hObject handle to btn0 (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.editDisplay,'String');
if strcmp(temp,'0')~=1
if strcmp(IsNew,'true')==1
set(handles.editDisplay,'String','0');
IsNew='false';
else
num=strcat(get(handles.editDisplay,'String'),'0');
set(handles.editDisplay,'String',num);
end
end
end% --- Executes on button press in btn1.function btn1_Callback(hObject, eventdata, handles)% hObject handle to btn1 (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
if strcmp(IsNew,'true')==1
set(handles.editDisplay,'String','1');
IsNew=0;
else
num=strcat(get(handles.editDisplay,'String'),'1');
set(handles.editDisplay,'String',num);
end
end
% --- Executes on button press in btn2.function btn2_Callback(hObject, eventdata, handles)% hObject handle to btn2 (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
if strcmp(IsNew,'true')==1
set(handles.editDisplay,'String','2');
IsNew='false',;
else
num=strcat(get(handles.editDisplay,'String'),'2');
set(handles.editDisplay,'String',num);
end
end
% --- Executes on button press in btnAdd.function btnAdd_Callback(hObject, eventdata, handles)% hObject handle to btnAdd (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.editDisplay,'String'));
Number1=jsq(Number1,Number2,opvalue);
set(handles.editDisplay,'String',num2str(Number1));
opvalue='+';
Number2='';
else
opvalue='+';
Number1=str2num(get(handles.editDisplay,'String'));
end
IsNew='true';
end
% --- Executes on button press in btn3.function btn3_Callback(hObject, eventdata, handles)% hObject handle to btn3 (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
if strcmp(IsNew,'true')==1
set(handles.editDisplay,'String','3');
IsNew='false',;
else
num=strcat(get(handles.editDisplay,'String'),'3');
set(handles.editDisplay,'String',num);
end
end
% --- Executes on button press in btn4.function btn4_Callback(hObject, eventdata, handles)% hObject handle to btn4 (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
if strcmp(IsNew,'true')==1
set(handles.editDisplay,'String','4');
IsNew='false',;
else
num=strcat(get(handles.editDisplay,'String'),'4');
set(handles.editDisplay,'String',num);
end
end
% --- Executes on button press in btn5.function btn5_Callback(hObject, eventdata, handles)% hObject handle to btn5 (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
if strcmp(IsNew,'true')==1
set(handles.editDisplay,'String','5');
IsNew='false',;
else
num=strcat(get(handles.editDisplay,'String'),'5');
set(handles.editDisplay,'String',num);
end
end
% --- Executes on button press in btnMinus.function btnMinus_Callback(hObject, eventdata, handles)% hObject handle to btnMinus (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.editDisplay,'String'));
Number1=jsq(Number1,Number2,opvalue);
set(handles.editDisplay,'String',num2str(Number1));
opvalue='-';
Number2='';
else
opvalue='-';
Number1=str2num(get(handles.editDisplay,'String'));
end
IsNew='true';
end
% --- Executes on button press in btn6.function btn6_Callback(hObject, eventdata, handles)% hObject handle to btn6 (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
if strcmp(IsNew,'true')==1
set(handles.editDisplay,'String','6');
IsNew='false',;
else
num=strcat(get(handles.editDisplay,'String'),'6');
set(handles.editDisplay,'String',num);
end
end
% --- Executes on button press in btn7.function btn7_Callback(hObject, eventdata, handles)% hObject handle to btn7 (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
if strcmp(IsNew,'true')==1
set(handles.editDisplay,'String','7');
IsNew='false',;
else
num=strcat(get(handles.editDisplay,'String'),'7');
set(handles.editDisplay,'String',num);
end
end
% --- Executes on button press in btn8.function btn8_Callback(hObject, eventdata, handles)% hObject handle to btn8 (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;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -