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

12 visualizaciones (últimos 30 días)
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!

Respuestas (1)

Walter Roberson
Walter Roberson el 15 de Abr. de 2025
Editada: Walter Roberson el 15 de Abr. de 2025
[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.

Categorías

Más información sobre Data Import and Analysis en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by