call recursive fun. erase txtfile
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (1)
Azzi Abdelmalek
le 9 Sep 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 commentaires
huda nawaf
le 9 Sep 2012
huda nawaf
le 9 Sep 2012
Azzi Abdelmalek
le 9 Sep 2012
if you post your function, it will be helpfull
Azzi Abdelmalek
le 9 Sep 2012
Modifié(e) : Azzi Abdelmalek
le 9 Sep 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
le 11 Sep 2012
Catégories
En savoir plus sur Data Type Conversion dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!