This expands on the operation of the built-in ROUND function to provide functionality to round to a given number of decimal places. For example,
>> round(pi)
ans =
3
>> round2dp(pi,3)
ans =
3.142
Cite As
Andrew (2025). ROUND2DP (https://www.mathworks.com/matlabcentral/fileexchange/24213-round2dp), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2008a
Compatible with any release
Platform Compatibility
Windows macOS LinuxCategories
Find more on Arithmetic Operations in Help Center and MATLAB Answers
Tags
Acknowledgements
Inspired by: round2
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |