matlab的logo是什么意思,Matlab更改figure上logo的方法

网上闲逛,发现很有意思是的代码,转载来玩玩。

function chgicon(h,filename)

%CHGICON changes the figure icon.

%CHGICON(H,FILENAME) changes the icon of a figure to an image specified by

%the string FILENAME, where H is a handle to the figure. If the file is not

%in the current directory or in a directory in the MATLAB path,specify the

%full pathname of the location on your system. If FILENAME is not a valid

%image file name, the function just removes the previous icon of the figure.

%%Example:

%h = figure;

%chgicon(h,'newIcon.png'); % replace 'newIcon.png' with your ima

%IMPORTANT NOTES:

%REPLACING THE MATLAB GUI ICON VIOLATES THE LICENSE AGREEMENT

% OF MATLAB. DO NOT USE THIS FUNCTION COMMERCIALLY.

if nargin<2

error('MATLAB:chgicon','%s','Too few input arguments!');

end

if nargin >2

error('MATLAB:chgicon','%s','Too many input arguments!');

end

newIcon = javax.swing.ImageIcon(filename);

javaFrame = get(h,'JavaFrame');

javaFrame.setFigureIcon(newIcon);

% 上面的函数保存在自己要使用的路径下,再调用即可

% 调用语句:

% h = figure

% chgicon(h,'C:/Users/mofeng/Desktop/12.jpg');

原图:

0818b9ca8b590ca3270a3433284dd417.png

修改后:

0818b9ca8b590ca3270a3433284dd417.png

转载自:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值