Add new line inside text file

Dear All,
I have a txt file containing:
a, b, c, d, e, f, g, h, i
I have an iteration:
for i=1:10
for j=1:10
dlmwrite('mydata.txt', myvar, '');
end
end
The problem is that it overwrite what I already have in my txt file and it only writes the last value.
What I want as a result in my mydata.txt is something like:
a, b, c, d, e, f, g, h, i
1, 3, 6, 4, 8, 1, 8, 9, 0
2, 5, 6, 7, 5, 4, 2, 9, 4
...
Thank you and regards, Sypou

 Respuesta aceptada

TAB
TAB el 16 de Abr. de 2012

0 votos

See
>> doc dlmwrite
Use dlmwrite with -append option.
Correct format --> dlmwrite(filename, M, '-append')

Más respuestas (0)

Etiquetas

Preguntada:

el 16 de Abr. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by