Matlab更改figure上logo的方法
更新时间:2023-11-19 11:40:01 阅读量: 教育文库 文档下载
Matlab更改figure上logo的方法
有会员朋友问我能不能修改matlab中figure左上角的logo图标,因此写了这个帖子。答案是肯定的。比如我用这个卡通头像来做新的logo(不用真人的,不侵犯人家肖像权)。
更换过后的效果是:
这样就能使用自己的QQ头像或者照片来作为自己作品的标志了。具体实现方法,其实十分简单,只需要一个函数chgicon.m 该函数用红色文字表示:
functionchgicon(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 image
% IMPORTANT NOTES:
%REPLACING THE MATLAB GUI ICON VIOLATES THE LICENSE AGREEMENT % OF MATLAB. DO NOT USE THIS FUNCTION COMMERCIALLY. %%Han Qun, Sept. 2005 %Copyright 2005-2006 Han Qun
%College of Precision Instrument and Opto-Electronics Engineering, %Tianjin University, 300072, P.R.China. %Email: junziyang@126.com %$Revision: 1.0 $ $Date: 2005/12/2 $ ifnargin<2
error('MATLAB:chgicon','%s','Too few input arguments!'); end ifnargin>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,'12.jpg');
就可以了。
再推广到GUI上也是一样的,只要在Create Fcn中调用这个函数就可以了:
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 chgicon(hObject,'12.jpg');
结果也是很成功:
正在阅读:
2017年度安全培训教育计划05-29
看破红尘的网名02-14
高考历史一轮复习 苏联社会主义经济体制的建立及经济改革复习练07-04
CAD多年经验总结及常见问题解决办法、CAD制图规范(不看后悔)09-21
(专家评审后)深基坑顶管专项施工方案10-28
软件项目质量控制12-26
教师《科技与创新》考试题库及答案整理04-16
美国和德国FDA创新医疗器械05-07
小学学校管理制度汇编05-03
- exercise2
- 铅锌矿详查地质设计 - 图文
- 厨余垃圾、餐厨垃圾堆肥系统设计方案
- 陈明珠开题报告
- 化工原理精选例题
- 政府形象宣传册营销案例
- 小学一至三年级语文阅读专项练习题
- 2014.民诉 期末考试 复习题
- 巅峰智业 - 做好顶层设计对建设城市的重要意义
- (三起)冀教版三年级英语上册Unit4 Lesson24练习题及答案
- 2017年实心轮胎现状及发展趋势分析(目录)
- 基于GIS的农用地定级技术研究定稿
- 2017-2022年中国医疗保健市场调查与市场前景预测报告(目录) - 图文
- 作业
- OFDM技术仿真(MATLAB代码) - 图文
- Android工程师笔试题及答案
- 生命密码联合密码
- 空间地上权若干法律问题探究
- 江苏学业水平测试《机械基础》模拟试题
- 选课走班实施方案
- 更改
- 方法
- Matlab
- figure
- logo
- CISM题库(250题含答案)
- 高校基层团组织活力现状及活力不足原因分析 主干
- 2018最新苏教版二年级数学上册期中试卷
- 献身使命,立足岗位做贡献
- 2012年1月长沙房地产市场研究报告 - 图文
- 天津大学2015春多媒体技术(大作业)答案 - 图文
- 幼儿园一周主要活动安排表
- 2014noip复赛模拟练习20(答案)
- 余杭区小学2017学年第二学期第2周工作安排 - 图文
- 西安市莲湖区初中学校学区划分一览表
- 酸奶制作过程 - 图文
- 化工原理习题第一部分流体流动答案
- 公共危机管理考试题及答案
- 《汽车美容与装饰》期末试题1及其答案
- 一个优秀团队必备的五个基本要素
- 交互式电子手册(IETM)介绍
- (老挝)重卡汽车4S店整体规划报告 - 图文
- 湘雅口腔颌面外科试题库
- 硅石墨烯复合负极材料体积膨胀及SEI膜的原因机理及解决方法
- 给水管网说明书