当前位置:网站首页>MATLAB如何修改默认设置
MATLAB如何修改默认设置
2022-07-03 06:17:00 【最爱大盘鸡】
今天在github上下载了一个代码,运行结束之后,发现它把我的figure里面的默认解释器改了。
原本的设置是:
interpreter = 'none'
但我打开figure的属性窗口一看,这个属性被改成了
interpreter = 'Latex'
这样在画图过程中,一旦文本里面有汉字,就会出现下面的警告:
警告: 更新 Text 时出错。 字符串标量或字符向量必须具备有效的解释器语法
解决方法有2个:
- 是以后每次写
legend()
或者xlabel()
、ylabel()
的时候加上interpreter = 'none'
- 把默认设置修改回原来的样子
我决定一劳永逸,选择第二个。
开始上网查资料,找到了这篇文章,介绍了如何把figure的背景色换成白色,代码是set(0,'defaultfigurecolor','w')
。我从这篇文章中受到启发,认为可以找到默认设置的句柄,再通过set()
设置句柄参数,恢复默认设置。多说一嘴,代码里面0
这个句柄代表的是计算机屏幕(可以参考这里)。
下一步是上网查找MATLAB的默认句柄有什么,找到了这篇文章。
作者说可以用get(0,'factory')
来获取默认的属性定义值。在MATLAB命令行里面输入这行命令之后,出现了好多好多可以设置的属性。但我找了一下,没有发现interpreter
的名字,感觉可能不是用这行代码来做。
当下心思一动,心想可以不可以把factory替换成default,在命令行输入代码get(0,'default')
,得到如下输出:
ans =
包含以下字段的 struct:
defaultFigurePosition: [680 558 560 420]
defaultFigurePaperPositionMode: 'auto'
defaultFigurePaperType: 'A4'
defaultFigurePaperUnits: 'centimeters'
defaultFigurePaperSize: [21 29.7000]
defaultTextInterpreter: 'latex'
defaultLegendInterpreter: 'latex'
defaultAxesTickLabelInterpreter: 'latex'
注意到最后三行出现了interpreter
和latex
的名字, 这就是要找的默认设置。
在命令行输入下面三行代码就可以把解释器换成MATLAB的默认设置了。
set(0,'defaultTextInterpreter','none');
set(0,'defaultLegendInterpreter','none');
set(0,'defaultAxesTickLabelInterpreter','none');
再次输入get(0,'default')
检查一下是否设置成功,得到如下输出。
ans =
包含以下字段的 struct:
defaultFigurePosition: [680 558 560 420]
defaultFigurePaperPositionMode: 'auto'
defaultFigurePaperType: 'A4'
defaultFigurePaperUnits: 'centimeters'
defaultFigurePaperSize: [21 29.7000]
defaultTextInterpreter: 'none'
defaultLegendInterpreter: 'none'
defaultAxesTickLabelInterpreter: 'none'
成功!这下在figure中画图用汉字的时候再也不会给警告了。
通过这件事情我觉得吧,还是得多思考多想一想怎么解决问题,解决问题后还要及时记录,防止自己忘记。
边栏推荐
- Phpstudy setting items can be accessed by other computers on the LAN
- Various usages of MySQL backup database to create table select and how many days are left
- 从小数据量 MySQL 迁移数据到 TiDB
- Introduction to software engineering
- The most classic 100 sentences in the world famous works
- Page text acquisition
- 技术管理进阶——你了解成长的全貌吗?
- [set theory] relational closure (relational closure solution | relational graph closure | relational matrix closure | closure operation and relational properties | closure compound operation)
- Selenium - 改变窗口大小,不同机型呈现的宽高长度会不一样
- Multithreading and high concurrency (7) -- from reentrantlock to AQS source code (20000 words, one understanding AQS)
猜你喜欢
Interesting research on mouse pointer interaction
项目总结--04
Multithreading and high concurrency (7) -- from reentrantlock to AQS source code (20000 words, one understanding AQS)
Cesium 点击获三维坐标(经纬度高程)
Detailed explanation of contextclassloader
Bio, NiO, AIO details
. Net program configuration file operation (INI, CFG, config)
IE browser flash back, automatically open edge browser
ruoyi接口权限校验
tabbar的设置
随机推荐
Jackson: what if there is a lack of property- Jackson: What happens if a property is missing?
Svn branch management
The most responsible command line beautification tutorial
23 design models
Get a screenshot of a uiscrollview, including off screen parts
Request weather interface format, automation
How to scan when Canon c3120l is a network shared printer
Kubernetes notes (IV) kubernetes network
Oauth2.0 - use database to store client information and authorization code
輕松上手Fluentd,結合 Rainbond 插件市場,日志收集更快捷
Kubernetes notes (IX) kubernetes application encapsulation and expansion
YOLOV3学习笔记
Push box games C #
When PHP uses env to obtain file parameters, it gets strings
MySQL帶二進制的庫錶導出導入
Support vector machine for machine learning
SQL实现将多行记录合并成一行
Es remote cluster configuration and cross cluster search
Jedis source code analysis (II): jediscluster module source code analysis
Print time Hahahahahaha