How do I use a user input for a desired number of decimal places in an fprintf or similar statement? The instructions are to use the user's input to display or print the correct number of decimal places once calculations are performed. Thanks!
Show older comments
I have tried using something like this to no avail:
fprintf('# Negative:\t\t\t\t\t%0.%f',decimal,neg)
Perhaps I need an sprintf statement or disp after the '# Negative' string? Any suggestions are most appreciated.
4 Comments
Roger Stafford
on 5 Mar 2017
You should read this article carefully:
https://www.mathworks.com/help/matlab/ref/fprintf.html
Jenel Darland
on 5 Mar 2017
Jenel Darland
on 6 Mar 2017
Accepted Answer
More Answers (0)
Categories
Find more on Scripts 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!