Matlab制作GUI

article/2025/10/6 17:53:44

效果图
在这里插入图片描述
图1.主界面
图2.其中一个子界面
图2.其中一个子界面

具体步骤

1.界面设置
输入guide并选中运行

2.菜单设置(图1上方)
在这里插入图片描述

3.背景图片
参考https://blog.csdn.net/leo0308/article/details/82694995

4.界面跳转
在这里插入图片描述
在自动生成的Untitled_5_Callback末尾加一句set(其余语句均自动生成,下略)

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)
set(interface4,'Visible','on') ;

添加一个菜单、文本框、图、坐标轴和按钮等(对fig文件操作),都会自动生成对应的函数(对m文件操作)(如按钮为callback),写在这个函数内函数就是点击该按钮执行的语句,右击改按钮打开检查器可查看属性,修改属性后按回车保存。

4.输入提示框
指图2内的步骤数,随机种子等,添加静态文本,打开检查器,修改string属性为步骤数
输入框和坐标轴同理

5.分析按钮
分以下几步:
(1)输入框提取,设置变量名

J=get(handles.edit1,'String');
J=str2double(J);

(2)算法代码略。
(3)画图,这里坐标轴改了属性名

plot(handles.axes1,[0:js-1],v(2,1:js));

(4)输出数据到excel

xlswrite('interface4sta.xlsx',v(2,1:js),'Sheet1');

6.GUI转exe文件
参考https://blog.csdn.net/caizanhui/article/details/112582223
需要注意的是,生成的exe并不能脱离matlab运行,需要从matlab官网安装一个支持文件(不是整个matlab),文件安装速度很快,但32位系统可能不支持。

图1、图2的全部代码展示,供改错参考,直接复制无法运行,想要传输必须传输扩展名为m和fig的源文件。
interface1

function varargout = interface1(varargin)
% INTERFACE1 MATLAB code for interface1.fig
%      INTERFACE1, by itself, creates a new INTERFACE1 or raises the existing
%      singleton*.
%
%      H = INTERFACE1 returns the handle to a new INTERFACE1 or the handle to
%      the existing singleton*.
%
%      INTERFACE1('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in INTERFACE1.M with the given input arguments.
%
%      INTERFACE1('Property','Value',...) creates a new INTERFACE1 or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before interface1_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to interface1_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 interface1% Last Modified by GUIDE v2.5 06-May-2022 22:58:17% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...'gui_Singleton',  gui_Singleton, ...'gui_OpeningFcn', @interface1_OpeningFcn, ...'gui_OutputFcn',  @interface1_OutputFcn, ...'gui_LayoutFcn',  [] , ...'gui_Callback',   []);
if nargin && ischar(varargin{1})gui_State.gui_Callback = str2func(varargin{1});
endif nargout[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
elsegui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT% --- Executes just before interface1 is made visible.
function interface1_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 interface1 (see VARARGIN)% Choose default command line output for interface1
handles.output = hObject;% Update handles structure
guidata(hObject, handles);% UIWAIT makes interface1 wait for user response (see UIRESUME)
% uiwait(handles.figure1);% --- Outputs from this function are returned to the command line.
function varargout = interface1_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 Untitled_1_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------
function Untitled_2_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------
function Untitled_3_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
set(interface2,'Visible','on') ;% --------------------------------------------------------------------
function Untitled_4_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
set(interface3,'Visible','on') ;% --------------------------------------------------------------------
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)
set(interface4,'Visible','on') ;% --- Executes during object creation, after setting all properties.
function figure1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to figure1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
ha=axes('units','normalized','pos',[0 0 1 1]);
uistack(ha);
ii=imread('mainpic.png');
image(ii);
colormap gray
set(ha,'handlevisibility','off','visible','off');% --------------------------------------------------------------------
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)% --------------------------------------------------------------------
function Untitled_7_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------
function Untitled_8_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------
function Untitled_9_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_9 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------
function Untitled_10_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_10 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------
function Untitled_11_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_11 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------
function Untitled_12_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_12 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------
function Untitled_13_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_13 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

interface4

function varargout = interface4(varargin)
% INTERFACE4 MATLAB code for interface4.fig
%      INTERFACE4, by itself, creates a new INTERFACE4 or raises the existing
%      singleton*.
%
%      H = INTERFACE4 returns the handle to a new INTERFACE4 or the handle to
%      the existing singleton*.
%
%      INTERFACE4('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in INTERFACE4.M with the given input arguments.
%
%      INTERFACE4('Property','Value',...) creates a new INTERFACE4 or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before interface4_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to interface4_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 interface4% Last Modified by GUIDE v2.5 10-Oct-2022 16:33:20% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...'gui_Singleton',  gui_Singleton, ...'gui_OpeningFcn', @interface4_OpeningFcn, ...'gui_OutputFcn',  @interface4_OutputFcn, ...'gui_LayoutFcn',  [] , ...'gui_Callback',   []);
if nargin && ischar(varargin{1})gui_State.gui_Callback = str2func(varargin{1});
endif nargout[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
elsegui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT% --- Executes just before interface4 is made visible.
function interface4_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 interface4 (see VARARGIN)% Choose default command line output for interface4
handles.output = hObject;% Update handles structure
guidata(hObject, handles);% UIWAIT makes interface4 wait for user response (see UIRESUME)
% uiwait(handles.figure1);% --- Outputs from this function are returned to the command line.
function varargout = interface4_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');
endfunction edit2_Callback(hObject, eventdata, handles)
% hObject    handle to edit2 (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 edit2 as text
%        str2double(get(hObject,'String')) returns contents of edit2 as a double% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit2 (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');
endfunction edit3_Callback(hObject, eventdata, handles)
% hObject    handle to edit3 (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 edit3 as text
%        str2double(get(hObject,'String')) returns contents of edit3 as a double% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit3 (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');
endfunction edit4_Callback(hObject, eventdata, handles)
% hObject    handle to edit4 (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 edit4 as text
%        str2double(get(hObject,'String')) returns contents of edit4 as a double% --- Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit4 (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');
endfunction edit5_Callback(hObject, eventdata, handles)
% hObject    handle to edit5 (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 edit5 as text
%        str2double(get(hObject,'String')) returns contents of edit5 as a double% --- Executes during object creation, after setting all properties.
function edit5_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit5 (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');
endfunction edit6_Callback(hObject, eventdata, handles)
% hObject    handle to edit6 (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 edit6 as text
%        str2double(get(hObject,'String')) returns contents of edit6 as a double% --- Executes during object creation, after setting all properties.
function edit6_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit6 (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');
endfunction edit7_Callback(hObject, eventdata, handles)
% hObject    handle to edit7 (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 edit7 as text
%        str2double(get(hObject,'String')) returns contents of edit7 as a double% --- Executes during object creation, after setting all properties.
function edit7_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit7 (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');
endfunction edit8_Callback(hObject, eventdata, handles)
% hObject    handle to edit8 (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 edit8 as text
%        str2double(get(hObject,'String')) returns contents of edit8 as a double% --- Executes during object creation, after setting all properties.
function edit8_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit8 (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');
endfunction edit9_Callback(hObject, eventdata, handles)
% hObject    handle to edit9 (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 edit9 as text
%        str2double(get(hObject,'String')) returns contents of edit9 as a double% --- Executes during object creation, after setting all properties.
function edit9_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit9 (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');
endfunction edit10_Callback(hObject, eventdata, handles)
% hObject    handle to edit10 (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 edit10 as text
%        str2double(get(hObject,'String')) returns contents of edit10 as a double% --- Executes during object creation, after setting all properties.
function edit10_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit10 (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');
endfunction edit11_Callback(hObject, eventdata, handles)
% hObject    handle to edit11 (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 edit11 as text
%        str2double(get(hObject,'String')) returns contents of edit11 as a double% --- Executes during object creation, after setting all properties.
function edit11_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit11 (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)
%% setup
N=2;% dimension of state
I=eye(N);% identity operatorJ=get(handles.edit1,'String');
J=str2double(J);% number of steps J=1e3;
gamma=get(handles.edit2,'String');
gamma=str2double(gamma);% observational noise variance is gamma^2*I gamma=1;
sigma=get(handles.edit3,'String');
sigma=str2double(sigma);% dynamics noise variance is sigma^2*I sigma=1;
C0=get(handles.edit4,'String');
C0=str2double(C0);% prior initial condition variance C0=eye(2);
m1=get(handles.edit5,'String');
m1=str2double(m1);
m2=get(handles.edit6,'String');
m2=str2double(m2);
m0=[m1;m2];% prior initial condition mean m0=[0;0];
sd=get(handles.edit7,'String');
sd=str2double(sd);rng(sd);% choose random number seed sd=10;
A1=get(handles.edit8,'String');
A1=str2double(A1);
A2=get(handles.edit9,'String');
A2=str2double(A2);
A3=get(handles.edit10,'String');
A3=str2double(A3);
A4=get(handles.edit11,'String');
A4=str2double(A4);
A=[A1 A2;A3 A4];% dynamics determined by A A=[0 1;-1 0];m=zeros(N,J);v=m;y=zeros(J,1);c=zeros(N,N,J);% pre-allocate
v(:,1)=m0+sqrtm(C0)*randn(N,1);% initial truth
m(:,1)=10*randn(N,1);% initial mean/estimate
c(:,:,1)=100*C0;% initial covariance
H=[1,0];% observation operator%% solution % assimilate!for j=1:J   v(:,j+1)=A*v(:,j) + sigma*randn(N,1);% truthy(j)=H*v(:,j+1)+gamma*randn;% observationmhat=A*m(:,j);% estimator predictchat=A*c(:,:,j)*A'+sigma^2*I;% covariance predict  d=y(j)-H*mhat;% innovationK=(chat*H')/(H*chat*H'+gamma^2);% Kalman gainm(:,j+1)=mhat+K*d;% estimator updatec(:,:,j+1)=(I-K*H)*chat;% covariance update    
endjs=21;
plot(handles.axes1,[0:js-1],v(2,1:js));
plot(handles.axes1,[0:js-1],m(2,1:js)+reshape(sqrt(c(2,2,1:js)),1,js),'r--');
plot(handles.axes1,[0:js-1],m(2,1:js)-reshape(sqrt(c(2,2,1:js)),1,js),'r--');
xlswrite('interface4sta.xlsx',v(2,1:js),'Sheet1');%plot(handles.axes1,[0:J],reshape(c(1,1,:)+c(2,2,:),J+1,1));
%plot([0:J],cumsum(reshape(c(1,1,:)+c(2,2,:),J+1,1))./[1:J+1]','m', ...
%'Linewidth',2); grid; hold;xlabel('iteration, j');axis([1 1000 0 50]);
%title('Kalman Filter Covariance, Ex. 1.2');%figure;plot([0:J],sum((v-m).^2));hold;
%plot([0:J],cumsum(sum((v-m).^2))./[1:J+1],'m','Linewidth',2);grid
%hold;xlabel('iteration, j');axis([1 1000 0 50]);
%title('Kalman Filter Error, Ex. 1.2')% --- 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)% --- Executes during object creation, after setting all properties.
function text2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to text2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called% --- Executes during object creation, after setting all properties.
function axes1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to axes1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called% Hint: place code in OpeningFcn to populate axes1

http://chatgpt.dhexx.cn/article/6TVj1JjF.shtml

相关文章

Matlab写的第一个GUI程序(程序设计,界面设计)

写在前面:博主用的Matlab版本是2016b,属于旧版本,大概在2019版本开始属于新版本叭,新版本写程序在APP菜单有设计APP这个选项,旧版本的则是在主页的新建选项下有GUI选项 目录 1.新建项目 1.1找到入口 1.2项目模板选择…

Matlab GUI界面设计

摘要:本篇博文基于MATLAB2014a进行GUI设计。 1.启动GUI设计 命令行输入guide,回车。 即可得到下面的对话框,进行相关的选择和设置 点击确定,得到两个文件,一个是.m文件,另一个是.fig文件,需要…

MATLAB(6)GUI应用介绍

目录 GUI编辑器控件属性回调函数 MATLAB常见的控件普通按钮切换按钮可编辑文本字符获取字符显示 复选框单选按钮弹出式菜单滑动条列表框表坐标区 附录各文件共享数据保存获取 GUI编辑器 MATLAB的GUI编辑器在命令行窗口输入“guide”启动,选择模板并点击确定后创建对…

matlab设计GUI可视化界面全方位解析

如何使用matlab设计GUI及导出 一、GUI的基础知识开始生成GUI界面回调函数Handles结构体GUI中的参数传递 二、控件介绍一、普通按钮二、可编辑文本(edit)和静态文本(text)三、单选框(radiobutton)和复选框&a…

matlabGUI入门

matlabGUI入门 前言1 基础知识1.1 函数1.2 数据类型1.3 绘图1.4 其它 2 GUIDE2.1 创建GUI界面2.2 模板选择2.3 控件2.4 对象浏览器2.5 回调函数2.6 属性检查器2.7 数据传输 前言 由窗口、菜单、图标、光标、按键、对话框和文本等各种图形对象组成的用户界面叫作图形用户界面&a…

matlab gui编程教程,matlab如何使用gui

如何在Matlab中打开GUI工具 两种方法1、输入guide回车。2、在工具栏里点击带笔形的gui。 为Matlab的GUI添加启动画面:添加启动画面,启动画面中可以添加想要添加的图像……VisualC可以实现这个功能,Matlab也可以实现,具体如下&am…

Matlab系列之GUI设计基础

Matlab系列之GUI设计基础 简介编辑界面菜单设计控件设计控件描述个人理解Matlab转译 控件属性【1】外观与行为【2】控件对象的信息【3】回调函数【4】状态信息 结束更多精彩,等你发现~ 简介 GUI即图形用户界面(Graphical User Interface),人…

BERT的get_sequence_output与get_pooled_output方法

BERT的get_sequence_output方法获取token向量是如何得到的? 通过如下方法得到,实际上获取的是encoder端最后一层编码层的特征向量。 BERT的get_pooled_output方法获取的句子向量是如何得到的? 通过如下方法得到,实际上获取的是[…

mybatis 连接池POOLED分析

mybatis提供了三种连接池的配置方式: 配置的位置:主配置文件SqlMapConfig.xml中的dataSource标签,type属性就是表示采用何种连接池方式。 type属性的取值: POOLED 采用传统的javax.sql.DataSource规范中的连接池,…

读论文:Pooled Contextualized Embeddings for Named Entity Recognition

最近在看命名实体识别方向的最新的paper。在这个方向&#xff0c;18年年底有一篇<contextual string embedding for sequence labeling>&#xff0c;在CoNLL03 数据集的F1值超过BERT达到了93.09。做法是弄了个预训练的character_embedding&#xff0c;用character_embedd…

pooled-jms_Hibernate隐藏的宝石:pooled-lo优化器

pooled-jms 介绍 在这篇文章中&#xff0c;我们将揭示一个序列标识符生成器&#xff0c;​​它结合了标识符分配效率和与其他外部系统的互操作性&#xff08;同时访问底层数据库系统&#xff09;。 传统上&#xff0c;有两种序列标识符策略可供选择。 序列标识符&#xff0c;…

idea__MyBatis框架08——连接池(POOLED 跟 UNPOOLED )

一、继续上一节&#xff0c;把一些不用的注释给清理掉&#xff0c;看一下我们的mybatis主配置文件&#xff0c;重点看type。 二、Type详细介绍&#xff1a; mybatis连接池提供了3种方式的配置&#xff1a; type属性就是表示采用何种连接池方式。type属性的取值&#xff1a;POOL…

PODNet: Pooled Outputs Distillation for Small-Tasks Incremental Learning论文详解ECCV2020

ECCV2020 论文地址&#xff1a;https://doi.org/10.1007/978-3-030-58565_6 代码地址&#xff1a;https://github.com/arthurdouillard/incremental learning.pytorch 目录 1.贡献点 2.方法 2.1 pool类型 2.2 POD&#xff08;Pooled Outputs Distillation&#xff09;方…

mybatis数据源(JNDI、POOLED、UNPOOLED)源码详解

一、概述 二、创建 mybatis数据源的创建过程稍微有些曲折。 1. 数据源的创建过程&#xff1b; 2. mybatis支持哪些数据源&#xff0c;也就是dataSource标签的type属性可以写哪些合法的参数&#xff1f; 弄清楚这些问题&#xff0c;对mybatis的整个解析流程就清楚了&#xff0c;…

XAConnectionFactory: failed to create pooled connection - DBMS down or unreachable 的解决方法

问题描述 项目启动出现报错&#xff1a;XAConnectionFactory: failed to create pooled connection - DBMS down or unreachable? 原因分析&#xff1a; Druid连接池问题&#xff0c;当Druid与Atomikos搭配时&#xff0c;如果MySQL版本高于8.0.11则不被支持 查看数据库使用…

没有手动提交事务,Mybatis 的 POOLED 连接池炸了

错误原因&#xff1a; 事务不关&#xff0c;并且非事务交替进行 总的来说&#xff0c;就是先开启了事务连接&#xff0c;未提交或关闭&#xff0c;导致连接池连接全部占满。 此时进行一次非事务连接操作&#xff0c;但是因为此时已经没有可以空闲的连接&#xff0c;并且创建的连…

【Flink】报错 No pooled slot available and request to ResourceManager for new slot failed

文章目录 1.场景11.1 概述1.2 问题1.场景1 1.1 概述 改报错请参考:【Flink】Flink 1.9 升级 到 flink 1.12.4 报错 shaded netty4 AbstractChannel AnnotatedConnectException 错误描述 报错信息: java.util.concurrent.CompletionException:

Oracle 关于Pooled connection request timed out

发生场景&#xff1a; 系统异常卡死&#xff0c;报错&#xff1a; 通过查找日志和业务接口定位&#xff0c;是因为数据库连接池溢出导致链接不上&#xff0c;系统卡死 异常测试代码如下格式&#xff1a; 测试了一个1000次的链接&#xff0c;每次连接都持续30秒&#xff0c;链…

MyBatis POOLED连接池深入了解

往期内容&#xff0c;如下 一、MyBatis简介 二、MyBatis环境搭建 三、MyBatis入门案例 四、MyBatis自定义 五、MyBatis CRUD操作 六、Mybatis中参数和返回值的深入了解 七、MyBatis 配置文件标签 我们在实际开发中都会使用连接池&#xff0c;因为它可以减少我们获取连接所消耗的…

unpooled与pooled

unpooled每次都是重新获取一个连接&#xff0c;底层源码如下 pooled去判断有没有&#xff0c;有就拿出来用&#xff0c;没有就创建新的&#xff0c;每次用完再还回去 mybatis poolde连接池原理 先去看空闲的有没&#xff0c;有就直接用&#xff0c;没有就去活动连接池里把最老…