How to generate a file with ANSI encoding in MATLAB (specifically appdesigner)?
11 views (last 30 days)
Show older comments
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!
0 Comments
Answers (1)
Walter Roberson
on 15 Apr 2025 at 16:57
Edited: Walter Roberson
on 15 Apr 2025 at 17:02
[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.
0 Comments
See Also
Categories
Find more on Data Import and Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!