Quiero generar un archivo de texto de la variable z que contiene en caracteres un nombre. Pero el archivo generado .txt me salen números decimales y yo quiero todo el texto
Show older comments
nombre = [74 101 115 115 105 99 97] %El nombre que guarda el arreglo es Jessica
z = char(nombre) % en la ventana de comandos si sale el nombre Jessica
save -ascii mydata.txt z %Al abrir el archivo de texto salen los siguientes numeros
% 7.4000000e+01 1.0100000e+02 1.1500000e+02 1.1500000e+02 1.0500000e+02 9.9000000e+01 9.7000000e+01
Answers (1)
Rik
on 26 Mar 2023
0 votes
If you want to write text, you need to write text. You either need to convert your variable to char, or use fprintf with an appropriate format specification ('c' or 's').
Categories
Find more on Mathematics 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!