I cannot save matlab editor, the .m file.
33 ビュー (過去 30 日間)
古いコメントを表示
Hi,
When I save the .m file, it warning that " The matlab editor cannot use US-ASCII encoding to save the file, please use UTF-8 encoding to save the file ". Am I missing some kind of file? What do I need to do? The computer I use is MAC, the matlab version is R0221a.
Look forward to your reply!
0 件のコメント
回答 (4 件)
Walter Roberson
2021 年 8 月 12 日
Use Save As to save the file. The saving box that comes up will have a menu that allows you to select the format of the file to save as. Make sure that UTF8 is selected, not ISO-8896-1 and not "all .m files"
0 件のコメント
Constantino Carlos Reyes-Aldasoro
2021 年 8 月 9 日
I guess that you must have used some special characters like accents, have you copy-pasted something into the editor?
2 件のコメント
Walter Roberson
2021 年 8 月 10 日
Right, you can get this message if your file includes any character whose Unicode code is outside the range 0 to 255.
DGM
2021 年 8 月 9 日
You might want to check what your locale settings are
feature('locale')
and see if any of this is of use:
My understanding was that this should be utf8 in that version/env, but maybe yours is set to us-ascii for some reason.
This might also be of help.
0 件のコメント
shakiba
2025 年 3 月 11 日
why when i want to save my matlab file i have 2 options one is (utf-8) and another is (windows-1256) which one is correct option for saving my file i picked both each time and after saving a function code it showed an error
1 件のコメント
Walter Roberson
2025 年 3 月 11 日
Save to windows-1256:
- if you need to use an editor that only supports single-byte characters
- if you need to read the file with a facility that only supports single-byte characters
- if you need to use the file with a sufficiently old version of MATLAB that did not support utf-8
Otherwise... you might as well save as utf-8. utf-8 is accepted by all modern editors and all modern methods of reading files. utf-8 is portable to other operating systems, where-as windows-1256 is not portable to other operating systems.
参考
カテゴリ
Help Center および File Exchange で Environment and Settings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!