call recursive fun. erase txtfile
Mostrar comentarios más antiguos
hi, I i have recursive function , each time call this function return different array.
I want to print these arrays into txt file, it is important to me store all arrays. But the problem each time is called function will erase the txtfile.
What I have to do to save all arrays?
THANKS IN ADVANCCE
Respuesta aceptada
Más respuestas (1)
Azzi Abdelmalek
el 9 de Sept. de 2012
maby your fclose(fid) is in the loop
fid = fopen('filename.txt', 'w');
for k=1:10
v=(1:k), %example
fprintf(fid, '%f\t',v);
fprintf(fid, '\n',[]);
end
fclose(fid);
5 comentarios
huda nawaf
el 9 de Sept. de 2012
huda nawaf
el 9 de Sept. de 2012
Azzi Abdelmalek
el 9 de Sept. de 2012
if you post your function, it will be helpfull
Azzi Abdelmalek
el 9 de Sept. de 2012
Editada: Azzi Abdelmalek
el 9 de Sept. de 2012
I think you can add this code inside your function just after cluster1
fprintf(fid, '%f\t',cluster1);
fprintf(fid, '\n',[]);
and call your function
fid = fopen('filename.txt', 'w');
F=devide();
fclose(fid);
huda nawaf
el 11 de Sept. de 2012
Categorías
Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!