problem with using fprintf
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Maryam Hamrahi
il 13 Giu 2016
Commentato: Walter Roberson
il 13 Giu 2016
I would like to use fprintf to save the following line as a text file.
%%number of points: x
x is a variable and for instance x=25
%%number of points: 25
thank you very much
2 Commenti
Risposta accettata
Azzi Abdelmalek
il 13 Giu 2016
fid=fopen('your_file.txt','w')
x=25
str=sprintf('number of points: %d',x)
fprintf(fid,'%s',str)
fclose(fid)
4 Commenti
Walter Roberson
il 13 Giu 2016
I would just go for
fid = fopen('your_file.txt', 'w');
x = 25;
fprintf(fid, '%%%%number of points: %d\n', x);
fclose(fid);
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Graphics Object Properties 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!