当前位置:网站首页>Matlab opens M file garbled solution
Matlab opens M file garbled solution
2022-07-06 13:49:00 【zhugby】
Matlab open .m The document has Chinese garbled , Because Matlab There is Two encoding formats :GBK and UTF-8, And different versions of Matlab The coding format may not be uniform , So in different versions Matlab Open file , Due to the change of coding format , It will cause comments to be garbled .
1. View your Matlab File encoding method , stay Matlab In the command line window feature('locale') , Here's the picture , You can see that the default code is GBK, The problem becomes take Matlab File encoding method GBK Modified into UTF-8;
2. Find you. Matlab The installation directory bin Under folder lcdata_utf8.xml file , Open with notepad and save as lcdata.xml file . Here we find lcdata.xml Already exists , No replacement , Modify the original lcdata.xml After the name of lcdata_utf8.xml file save as lcdata.xml file .
3. Notepad open lcdata.xml file ,ctrl+f lookup <encoding name="GBK">, Find this section ;
take This short piece of code is deleted
4. lookup <encoding name="UTF-8">, Find this section ;
Add the statement <encoding_alias name="GBK"/> As shown below
5. Save the file , close Matlab Open it again , The code is correct !
Similarly, if UTF-8 Coded Matlab Open Chinese garbled , Only need to UTF-8 Turn into GBK The encoding format is ok , The same idea is to <encoding name="UTF-8"> Partial code deletion , stay <encoding name="GBK"> Add <encoding_alias name="utf8"/> Just fine .
——————————————————————————————————————————
The above method can solve the error of Chinese garbled code , However, it was later found that Chinese characters in the command line window may be garbled , The above method has changed jvmEncoding=utf8 But other codes are still GBK, This inconsistency may lead to many conflicts , Therefore, the above methods should be used with caution , Not really recommended . After stepping on the thunder , So , Another two methods are summarized .
The second kind Simple and crude method , It has been ensured MATLAB Encoded as GBK however .M The file code is UTF8 after , Use the notepad that comes with your computer to open this M file , choice “ Save as ”, Modify the coding method to “ANSI”, Save the file and reuse IDE open .M File can . This is not applicable to large quantities of multiple files , It's hard to open one by one , And there may be omissions .
The third kind of Way , If you have notepad++ Words , It's more convenient ! It is suggested that friends who write code should have one in hand , Slowly you will find that you can't live without him .
1) First , Menu bar selection file > Open the folder as a workspace , Put the entire folder where your code is located .
2) Choose .m file , View this... In the menu bar .M Coding of documents , if UTF-8 Coding or other coding methods that cannot be displayed normally , Two options , code > Turn into ANSI code or code > Coded character set > chinese >GB2312( Simplified Chinese ), Check the encoding format of all files in the folder , Conversion save .
3)matlab open , The Chinese characters of all files are displayed normally, and the Chinese display of the command line window is also normal .
边栏推荐
- 2022 Teddy cup data mining challenge question C idea and post game summary
- [dark horse morning post] Shanghai Municipal Bureau of supervision responded that Zhong Xue had a high fever and did not melt; Michael admitted that two batches of pure milk were unqualified; Wechat i
- It's never too late to start. The tramp transformation programmer has an annual salary of more than 700000 yuan
- 关于双亲委派机制和类加载的过程
- 【黑马早报】上海市监局回应钟薛高烧不化;麦趣尔承认两批次纯牛奶不合格;微信内测一个手机可注册俩号;度小满回应存款变理财产品...
- 8. C language - bit operator and displacement operator
- FAQs and answers to the imitation Niuke technology blog project (I)
- 【九阳神功】2017复旦大学应用统计真题+解析
- [中国近代史] 第六章测验
- Write a program to simulate the traffic lights in real life.
猜你喜欢
1. First knowledge of C language (1)
2. Preliminary exercises of C language (2)
Wei Pai: the product is applauded, but why is the sales volume still frustrated
记一次猫舍由外到内的渗透撞库操作提取-flag
PriorityQueue (large root heap / small root heap /topk problem)
Leetcode. 3. Longest substring without repeated characters - more than 100% solution
Custom RPC project - frequently asked questions and explanations (Registration Center)
20220211-CTF-MISC-006-pure_ Color (use of stegsolve tool) -007 Aesop_ Secret (AES decryption)
[hand tearing code] single case mode and producer / consumer mode
(original) make an electronic clock with LCD1602 display to display the current time on the LCD. The display format is "hour: minute: Second: second". There are four function keys K1 ~ K4, and the fun
随机推荐
5. Download and use of MSDN
7-9 制作门牌号3.0(PTA程序设计)
Using qcommonstyle to draw custom form parts
Aurora system model of learning database
[中国近代史] 第五章测验
[dark horse morning post] Shanghai Municipal Bureau of supervision responded that Zhong Xue had a high fever and did not melt; Michael admitted that two batches of pure milk were unqualified; Wechat i
记一次猫舍由外到内的渗透撞库操作提取-flag
SRC挖掘思路及方法
The difference between cookies and sessions
The difference between overloading and rewriting
Beautified table style
This time, thoroughly understand the MySQL index
强化学习系列(一):基本原理和概念
Miscellaneous talk on May 14
The latest tank battle 2022 - Notes on the whole development -2
仿牛客技术博客项目常见问题及解答(一)
Write a program to simulate the traffic lights in real life.
The latest tank battle 2022 - full development notes-3
【九阳神功】2020复旦大学应用统计真题+解析
【VMware异常问题】问题分析&解决办法