当前位置:网站首页>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中画图用汉字的时候再也不会给警告了。
通过这件事情我觉得吧,还是得多思考多想一想怎么解决问题,解决问题后还要及时记录,防止自己忘记。
边栏推荐
- Mysql5.7 group by error
- Clickhouse learning notes (2): execution plan, table creation optimization, syntax optimization rules, query optimization, data consistency
- PMP笔记记录
- Kubernetes notes (VII) kuberetes scheduling
- [set theory] relational closure (relational closure solution | relational graph closure | relational matrix closure | closure operation and relational properties | closure compound operation)
- Migrate data from Amazon aurora to tidb
- Une exploration intéressante de l'interaction souris - pointeur
- Simple understanding of ThreadLocal
- Leetcode solution - 02 Add Two Numbers
- Cannot get value with @value, null
猜你喜欢

After the Chrome browser is updated, lodop printing cannot be called

SVN分支管理

How to scan when Canon c3120l is a network shared printer

Reinstalling the system displays "setup is applying system settings" stationary

Simple solution of small up main lottery in station B

Kubernetes notes (VII) kuberetes scheduling

Svn branch management

The most responsible command line beautification tutorial

Synthetic keyword and NBAC mechanism

JMeter performance automation test
随机推荐
项目总结--2(Jsoup的基本使用)
Kubernetes notes (III) controller
Openresty best practices
YOLOV1学习笔记
使用conda创建自己的深度学习环境
In depth analysis of kubernetes controller runtime
智牛股项目--04
After the Chrome browser is updated, lodop printing cannot be called
ODL framework project construction trial -demo
Print time Hahahahahaha
Use abp Zero builds a third-party login module (I): Principles
PMP notes
Kubernetes notes (IX) kubernetes application encapsulation and expansion
Kubernetes notes (VIII) kubernetes security
Jedis source code analysis (I): jedis introduction, jedis module source code analysis
使用 Abp.Zero 搭建第三方登录模块(一):原理篇
Phpstudy setting items can be accessed by other computers on the LAN
Oauth2.0 - user defined mode authorization - SMS verification code login
Leetcode problem solving summary, constantly updating!
CKA certification notes - CKA certification experience post