フィルターのクリア

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

3 ビュー (過去 30 日間)
Cinthya
Cinthya 2023 年 3 月 24 日
回答済み: Rik 2023 年 3 月 26 日
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

回答 (1 件)

Rik
Rik 2023 年 3 月 26 日
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').

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by