Writing text file
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
If i have a variable, say time=1000, and i want to write this into a txt file, how do i do that?
this is what i have tried:
fid = fopen('exp.txt', 'w');
fprintf(fid, 'time');
fclose(fid);
thanks
0 commentaires
Réponse acceptée
Walter Roberson
le 13 Jan 2012
fid = fopen('exp.txt', 'w');
fprintf(fid, '%g\n', time);
fclose(fid);
2 commentaires
Walter Roberson
le 16 Jan 2012
Works fine for me.
>> time = 1000
time =
1000
>> fid = fopen('exp.txt', 'w');
fprintf(fid, '%g\n', time);
fclose(fid);
>> !cat exp.txt
1000
Plus de réponses (1)
sunil anandatheertha
le 17 Jan 2012
ahhhhhhh, i use the dlmwrite('D:\rrr.txt','delimiter','\t') instead.
Whichever works for the moment !! ;)
0 commentaires
Voir également
Catégories
En savoir plus sur Characters and Strings dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!