b=fprintf how to
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Opariuc Andrei
il 30 Ott 2020
Commentato: Star Strider
il 30 Ott 2020
a=2.65987 ,after using the fprintf('%0.5g\n',a) i get the value i want being 2.6599 i tried doing b=fprintf('%0.5g\n',a) (i wanted to keep a better track of my work ) but it modified my result into 7 ,is there a way of keeping the b=fprintf('%0.5g\n',a) and still keeping the initial value 2.6599 ?
0 Commenti
Risposta accettata
Star Strider
il 30 Ott 2020
b=sprintf('%0.5g\n',a)
It is a separate line of code, however you get to retain the result.
2 Commenti
Star Strider
il 30 Ott 2020
As always, my pleasure!
In your original fprintf call, ‘b’ was the number of bytes fprintf wrote. See Get Number of Bytes Written to File for an detailed explanation.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Environment and Settings in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!