[EDIT: Sat Jun 11 05:03:32 UTC 2011 - Reformat - MKF]
function wr(vect, nomf)
[x y]=size(vect);
write=fopen(nomf,'w');
for i=1:y
fprintf(write,'%d\n',vect(1,i));
end
fclose(write);
end
I use this code hope to see the result in .txt file some kind vertical:
1
2
3
but the real result is: 123 What is \n for exactly, I found in the help, it use get a linefeed. Anyone know about this, pls help me!

 Respuesta aceptada

Matt Fig
Matt Fig el 11 de Jun. de 2011

0 votos

If you open the file in wordpad, you should see it vertical.
To make it look vertical in notepad, use:
%d\r\n
as the format string.

1 comentario

Vibol TEAV
Vibol TEAV el 11 de Jun. de 2011
You guy, master of Matlab. Thanks!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Characters and Strings en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 11 de Jun. de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by