Matlab GUI编程技巧(十九)【实战二】:超强科学计算器的设计,功能齐全

🔗 运行环境:Matlab

🚩 撰写作者:左手の明天

🥇 精选专栏:《python》

🔥  推荐专栏:《算法研究》


💗 大家好🤗🤗🤗,我是左手の明天!💗

📆  最近更新:2022 年 6 月 20 日,左手の明天的第 262 篇原创博客

📚 更新于专栏:Matlab GUI编程技巧


目录

🚩打开GUI设计界面

🚩总体设计

🚩各功能模块实现

🔥A. 数字键设计

🔥B. 四则运算函数

🔥C. 科学计算函数

🔥D. 退格键

🔥E. 清屏键函数

🔥F.右键函数

🚩问题和解决方法

🚩附录(源代码)


利用MATLAB GUI设计实现一个图形用户界面的计算器程序,要求实现:

  • A. 具有友好的用户图形界面。实现十进制数的加、减、乘、除、乘方、取模等简单计算。
  • B. 科学计算函数,包括(反)正弦、(反)余弦、(反)正切、(反)余切、开方、指数等函数运行。
  • C. 能够保存上次历史计算的答案,显示答案存储器中的内容。
  • D. 有清除键,能清除操作。
  • E. 独立存储器功能,使之可以直接输入存储器,可与存储器中的数值相加减。能够清除独立存储器中的内容。

🚩打开GUI设计界面

首先输入guide命令,将出现以下界面:

选择第一个点击确定将生成一个新的GUI编辑界面:


🚩总体设计

在GUI设计中主要用到三种控件,显示框用到文本编辑框(edit text),说明框用到静态文本框(Static text),数字以及运算等按钮用到命令按钮(push button)。然后再通过各个按钮的回调函数,实现简单的计算功能。

首先用MATLAB GUI功能,在绘制一个静态文本框和一个文本编辑框,以及32个命令按钮,调整好各控件大小、颜色,整体布局如图所示:

然后通过双击个按钮来改写其属性,在m文件中编写其回调函数,最后在运行调试。 


🚩各功能模块实现

🔥A. 数字键设计

0—9以及小数点函数都一样,只是参数不同:

global jj
textString = get(handles.text1,'String');
if(strcmp(textString,'0.')==1)&(jj==0)
   set(handles.text1,'String','1') ;
else
textString =strcat(textString,'1');
set(handles.text1,'String',textString)
end
jj=0;

 

🔥B. 四则运算函数

textString = get(handles.text1,'String');
textString =strcat(textString,'+');
set(handles.text1,'String',textString)

 

🔥C. 科学计算函数

textString = get(handles.text1,'String');
if(strcmp(textString,'0.')==1)
   set(handles.text1,'String','0.') ;
else
a = strread(textString, '%f');
a=sin(a);
set(handles.text1,'String',a)
end

或

textString=handles.text1;
textString=sin(str2num(get(handles.text1,'String'))*pi/180);
set(handles.text1,'String',num2str(textString))

Sin45的计算结果=

 经过计算,这些结果均与实际结果相吻合,计算器的功能实现的较为完好。

🔥D. 退格键

通过取屏幕值,计算出其字符长度,然后取其前N-1项的值来实现退格:

global jj
textString = get(handles.text1,'String');
if(strcmp(textString,'0.')==1)&(jj==0)
   set(handles.text1,'String','0.') ;
else
    ss=char(textString);
    l=length(textString);
    textString=ss(1:l-1);
set(handles.text1,'String',textString)
end
jj=0;

🔥E. 清屏键函数

set(handles.text1,'String','0.') ;

🔥F.右键函数

gtext('大家好;我是智能机器人-my name is robot');
close(gcf);

🚩问题和解决方法

→问题一:小数点可以连续输入。

解决方法:用strfind函数查看文本框里有几个小数点,如果已经有一个了,再按小数点就保持不变。

→问题二:按过运算符号后一个数不等于一个数,比如:输入1,按等号,会出来一个3,经过长时间分析得知,这是由于在按运算符号时,系统记录了文本框里的数但没有清空,才会出现这种问题。

解决方法:再申请一个不同于加减乘除的另一个符号,并将按过运算符后记录的数值置0。

→问题三:按对数函数键时,负数也能运算。

解决方法:通过加入if判断语句来判断输入的值是否为负,若为负则输出error.


🚩附录(源代码)

function varargout = jisuanqi(varargin)
% JISUANQI M-file for jisuanqi.fig
%      JISUANQI, by itself, creates a new JISUANQI or raises the existing
%      singleton*.
%
%      H = JISUANQI returns the handle to a new JISUANQI or the handle to
%      the existing singleton*.
%
%      JISUANQI('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in JISUANQI.M with the given input arguments.
%
%      JISUANQI('Property','Value',...) creates a new JISUANQI or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before jisuanqi_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to jisuanqi_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
% Copyright 2002-2003 The MathWorks, Inc.
% Edit the above text to modify the response to help jisuanqi
% Last Modified by GUIDE v2.5 04-Dec-2012 17:06:43
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @jisuanqi_OpeningFcn, ...
                   'gui_OutputFcn',  @jisuanqi_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(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 jisuanqi is made visible.
function jisuanqi_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 jisuanqi (see VARARGIN)
% Choose default command line output for jisuanqi
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes jisuanqi wait for user response (see UIRESUME)
% uiwait(handles.figure1);
%定义全局变量jj 用于数字的设定
global jj ;
%设置句柄,用于将按键接收的值返回给主程序
set(handles.text1,'String','0.');
jj=0;
% --- Outputs from this function are returned to the command line.
function varargout = jisuanqi_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;
function edit1_Callback(hObject, eventdata, handles)
% hObject    handle to edit1 (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 edit1 as text
%        str2double(get(hObject,'String')) returns contents of edit1 as a double
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit1 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global jj
textString = get(handles.text1,'String');
if(strcmp(textString,'0.')==1)&(jj==0)
   set(handles.text1,'String','1') ;
else
textString =strcat(textString,'1');
set(handles.text1,'String',textString)
end
jj=0;
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global jj
textString = get(handles.text1,'String');
 if(strcmp(textString,'0.')==1)&(jj==0)
   set(handles.text1,'String','2') ;
else
textString =strcat(textString,'2');
set(handles.text1,'String',textString)
end
jj=0;
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global jj
textString = get(handles.text1,'String');
 
if(strcmp(textString,'0.')==1)&(jj==0)
   set(handles.text1,'String','3') ;
else
textString =strcat(textString,'3');
set(handles.text1,'String',textString)
end
jj=0;
% --- Executes on button press in pushbutton13.
function pushbutton13_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton13 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global jj
textString = get(handles.text1,'String');
if(strcmp(textString,'0.')==1)&(jj==0)
   set(handles.text1,'String','+') ;
else
textString = get(handles.text1,'String');
textString =strcat(textString,'+');
set(handles.text1,'String',textString)
end
jj=0;
% --- Executes on button press in pushbutton14.
function pushbutton14_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton14 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global jj
textString = get(handles.text1,'String');
if(strcmp(textString,'0.')==1)&(jj==0)
   set(handles.text1,'String','-') ;
else
textString = get(handles.text1,'String');
textString =strcat(textString,'-');
set(handles.text1,'String',textString)
end
jj=0;
% --- Executes on button press in pushbutton21.
function pushbutton21_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton21 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%textString = get(handles.text1,'String');
%strcmp(textString,'0.')
%(if(strcmp(textString,'0.')==1)
   %%else
%a = strread(textString, '%f');
%a=a*a;
%set(handles.text1,'String',a)
%end)
textString=get(handles.text1,'String')
textString=strcat(textString,'^2')
set(handles.text1,'String',textString)
% --- 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)
textString = get(handles.text1,'String');
%strcmp(textString,'0.')
textString=handles.text1;
textString=sin(str2num(get(handles.text1,'String'))*pi/180);
set(handles.text1,'String',num2str(textString))
%a = strread(textString, '%f')
%textString=get(handles.text1,'String')
%textString=strcat(textString,'sin')
%set(handles.text1,'String',textString)
% --- 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)
textString = get(handles.text1,'String');
%strcmp(textString,'0.')
textString = get(handles.text1,'String');
if(strcmp(textString,'0.')==1)
   set(handles.text1,'String','0.') ;
else
a = strread(textString, '%f');
a=asin(a);
set(handles.text1,'String',a)
end
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global jj
textString = get(handles.text1,'String');
if(strcmp(textString,'0.')==1)&(jj==0)
   set(handles.text1,'String','4') ;
else
textString =strcat(textString,'4');
set(handles.text1,'String',textString)
end
jj=0;
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global jj
textString = get(handles.text1,'String');
if(strcmp(textString,'0.')==1)&(jj==0)
   set(handles.text1,'String','5') ;
else
textString =strcat(textString,'5');
set(handles.text1,'String',textString)
end
jj=0;
% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global jj
textString = get(handles.text1,'String');
if(strcmp(textString,'0.')==1)&(jj==0)
   set(handles.text1,'String','6') ;
else
textString =strcat(textString,'6');
set(handles.text1,'String',textString)
end
jj=0;
% --- Executes on button press in pushbutton15.
function pushbutton15_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton15 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global jj
textString = get(handles.text1,'String');
if(strcmp(textString,'0.')==1)&(jj==0)
   set(handles.text1,'String','*') ;
else
textString = get(handles.text1,'String');
textString =strcat(textString,'*');
set(handles.text1,'String',textString)
end
jj=0;
% --- Executes on button press in pushbutton16.
function pushbutton16_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton16 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global jj
textString = get(handles.text1,'String');
if(strcmp(textString,'0.')==1)&(jj==0)
   set(handles.text1,'String','/') ;
else
textString = get(handles.text1,'String');
textString =strcat(textString,'/');
set(handles.text1,'String',textString)
end
jj=0;
% --- Executes on button press in pushbutton24.
function 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)
textString = get(handles.text1,'String');
%strcmp(textString,'0.')
if(strcmp(textString,'0.')==1)
   set(handles.text1,'String','0.') ;
else
a = strread(textString, '%f');
if(a<0)
 set(handles.text1,'String','error') ; 
else
a=sqrt(a);
set(handles.text1,'String',a)
end
end
% --- Executes on button press in pushbutton25.
function pushbutton25_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton25 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
textString = get(handles.text1,'String');
%strcmp(textString,'0.')
textString=handles.text1;
textString=cos(str2num(get(handles.text1,'String'))*pi/180);
set(handles.text1,'String',num2str(textString))
% --- Executes on button press in pushbutton26.
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)
textString = get(handles.text1,'String');
%strcmp(textString,'0.')
if(strcmp(textString,'0.')==1)
   set(handles.text1,'String','0.') ;
else
a = strread(textString, '%f');
a=acos(a);
set(handles.text1,'String',a)
end
% --- Executes on button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global jj
textString = get(handles.text1,'String');
if(strcmp(textString,'0.')==1)&(jj==0)
   set(handles.text1,'String','7') ;
else
textString =strcat(textString,'7');
set(handles.text1,'String',textString)
end
jj=0;
% --- Executes on button press in pushbutton8.
function pushbutton8_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global jj
textString = get(handles.text1,'String');
if(strcmp(textString,'0.')==1)&(jj==0)
   set(handles.text1,'String','8') ;
else
textString =strcat(textString,'8');
set(handles.text1,'String',textString)
end
jj=0;
% --- Executes on button press in pushbutton9.
function pushbutton9_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton9 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global jj
textString = get(handles.text1,'String');
 if(strcmp(textString,'0.')==1)&(jj==0)
   set(handles.text1,'String','9') ;
else
textString =strcat(textString,'9');
set(handles.text1,'String',textString)
end
jj=0;
% --- Executes on button press in pushbutton17.
function pushbutton17_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton17 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
textString = get(handles.text1,'String');
if(strcmp(textString,'0.')==1)
   set(handles.text1,'String','(') ;
else
textString =strcat(textString,'(');
set(handles.text1,'String',textString)
end
% --- Executes on button press in pushbutton18.
function pushbutton18_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton18 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
textString = get(handles.text1,'String');
if(strcmp(textString,'0.')==1)
   set(handles.text1,'String',')') ;
else
textString =strcat(textString,')');
set(handles.text1,'String',textString)
end
% --- Executes on button press in pushbutton27.
function pushbutton27_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton27 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
textString = get(handles.text1,'String');
%strcmp(textString,'0.')
 if(strcmp(textString,'0.')==1)
   set(handles.text1,'String','0.') ;
else
a = strread(textString, '%f');
if(a<=0)
 set(handles.text1,'String','error');   
else   
a=log10(a);
set(handles.text1,'String',a)
end
end
% --- Executes on button press in pushbutton28.
function pushbutton28_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton28 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
textString = get(handles.text1,'String');
%strcmp(textString,'0.')
textString=handles.text1;
textString=tan(str2num(get(handles.text1,'String'))*pi/180);
set(handles.text1,'String',num2str(textString))
% --- 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)
textString = get(handles.text1,'String');
%strcmp(textString,'0.')
if(strcmp(textString,'0.')==1)
   set(handles.text1,'String','0.') ;
else
a = strread(textString, '%f');
a=atan(a);
set(handles.text1,'String',a)
end
% --- Executes on button press in pushbutton10.
function pushbutton10_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton10 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
 global jj
textString = get(handles.text1,'String');
if(strcmp(textString,'0.')==1)&(jj==0)
   set(handles.text1,'String','0.') ;
else
textString =strcat(textString,'0');
set(handles.text1,'String',textString)
end
jj=0;
% --- Executes on button press in pushbutton11.
function pushbutton11_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton11 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global jj
textString = get(handles.text1,'String');
if(strcmp(textString,'0.')==1)&(jj==0)
   set(handles.text1,'String','0.') ;
else
    ss=char(textString);
    l=length(textString);
    textString=ss(1:l-1);
set(handles.text1,'String',textString)
 end
jj=0;
% --- Executes on button press in pushbutton12.
function pushbutton12_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton12 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
set(handles.text1,'String','0.') ;
% --- Executes on button press in pushbutton19.
function pushbutton19_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton19 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global jj 
textString = get(handles.text1,'String');
if(strcmp(textString,'0.')==1)
   set(handles.text1,'String','0.') ;
   jj=1;
else
textString =strcat(textString,'.');
set(handles.text1,'String',textString)
end
% --- Executes on button press in pushbutton20.
function pushbutton20_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton20 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
textString=get(handles.text1,'String')
s=eval(textString)
set(handles.text1,'String',s)
% --- 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)
textString = get(handles.text1,'String');
%strcmp(textString,'0.')
if(strcmp(textString,'0.')==1)
   set(handles.text1,'String','0.') ;
else
a = strread(textString, '%f');
if(a<0)
set(handles.text1,'String','error') ;  
else
a=log2(a);
set(handles.text1,'String',a);
end
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)
textString = get(handles.text1,'String');
%strcmp(textString,'0.')
textString=handles.text1;
textString=cot(str2num(get(handles.text1,'String'))*pi/180);
set(handles.text1,'String',num2str(textString))
% --- 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)
textString = get(handles.text1,'String');
%strcmp(textString,'0.')
if(strcmp(textString,'0.')==1)
   set(handles.text1,'String','0.') ;
else
a = strread(textString, '%f');
a=acot(a);
set(handles.text1,'String',a)
end
% --------------------------------------------------------------------
function Untitled_5_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%open('1.bmp')
gtext('大家好;我是智能机器人-my name is robot');
% --------------------------------------------------------------------
function J_Callback(hObject, eventdata, handles)
% hObject    handle to J (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function Untitled_6_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
close(gcf);

🌟全文共 20340 个字码字总结不易老铁们来个三连点赞、关注、评论🌟

🌟作者左手の明天🌟

🌟原创不易,转载请联系作者并注明出处🌟


 

  • 13
    点赞
  • 43
    收藏
  • 打赏
    打赏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
©️2022 CSDN 皮肤主题:猿与汪的秘密 设计师:我叫白小胖 返回首页
评论 3

打赏作者

左手の明天

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值