Is there any way to print values to more decimal places using fprintf?
15 views (last 30 days)
Show older comments
fprintf('The value claculated for Vo is %f \n',est)
0 Comments
Accepted Answer
Stephen23
on 4 Nov 2021
Edited: Stephen23
on 4 Nov 2021
est = pi;
fprintf('The value claculated for Vo is %f \n',est)
fprintf('The value claculated for Vo is %.10f \n',est)
2 Comments
Stephen23
on 11 Mar 2024
"what if you wanted a specific number of digits before the decimal"
Then you can specify the fieldwidth, e.g. to print a total of 16 characters with leading zeros:
est = pi;
fprintf('The value claculated for Vo is %016.10f \n',est)
More Answers (0)
See Also
Categories
Find more on Workspace Variables and MAT Files in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!