Writing text file
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Walter Roberson
il 13 Gen 2012
fid = fopen('exp.txt', 'w');
fprintf(fid, '%g\n', time);
fclose(fid);
2 Commenti
Walter Roberson
il 16 Gen 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
Più risposte (1)
sunil anandatheertha
il 17 Gen 2012
ahhhhhhh, i use the dlmwrite('D:\rrr.txt','delimiter','\t') instead.
Whichever works for the moment !! ;)
0 Commenti
Vedere anche
Categorie
Scopri di più su JSON Format in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!