Number of decimal places for Matrix Entry
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Joe
il 16 Gen 2014
Commentato: Walter Roberson
il 17 Gen 2014
I want to increase the number of decimal places a figure can accurately be shown in an entry of a Matrix, using fprintf it shows all entries up to 4dp but how can I increase the d.p?
Thanks
Joe
Risposta accettata
Walter Roberson
il 16 Gen 2014
What is a "Matrix" for this purpose?
What format are you using with fprintf() ?
fprintf('%.999g\n', pi)
2 Commenti
Walter Roberson
il 17 Gen 2014
>> fprintf('%10.7f\n', pi)
3.1415927
Is what you are doing like
A = fprintf('%10.7f', pi);
If it is then what is being stored in A is the number of elements output, not the string. If you want the string use sprintf
A = sprintf('%10.7f', pi);
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Characters and Strings 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!