Matlab GUI 界面编程:界面左上角图标更改

Matlab GUI 界面编程:界面左上角图标更改

在界面的m文件中,找到界面的OpeningFcn函数

% --- Executes just before day1 is made visible.
function day1_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 day1 (see VARARGIN)
h = handles.figure1; %获取句柄
newIcon = javax.swing.ImageIcon('图标.jpg'); %读取图片文件
figFrame = get(h,'JavaFrame');
figFrame.setFigureIcon(newIcon);
% Choose default command line output for day1
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);

你可能感兴趣的:(matlab,GUI)