How to generate a file with ANSI encoding in MATLAB (specifically appdesigner)?

12 ビュー (過去 30 日間)
Amir
Amir 2025 年 4 月 15 日
編集済み: Walter Roberson 2025 年 4 月 15 日
Hello,
I am trying to generate a file with ANSI encoding through MATLAB appdesigner. I can do it in the UTF-8 encoding, but I cannot do it with ANSI. I need some characters from ANSI that is necessary. Thanks for the help in advance!

回答 (1 件)

Walter Roberson
Walter Roberson 2025 年 4 月 15 日
編集済み: Walter Roberson 2025 年 4 月 15 日
[fid, msg] = fopen(FileName, 'w', 'n', 'US-ASCII');
Note that US-ASCII only covers the first 128 characters (0 to 127), and that subset is the same as the first 128 characters of Unicode and UTF-8. If you were to use
[fid, msg] = fopen(FileName, 'w');
and simply not write any characters beyond 127, then the resulting file would be the same as US-ASCIIl.
... If you just happen to mean ANSI instead of ASCII, then that is not well defined, but you could open with 'Windows-1252' as a good guess.

カテゴリ

Help Center および File ExchangeData Import and Analysis についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by