RoundX - Round to desired precision

Version 1.0.0.0 (1,5 ko) par dberm22
Rounds the elements of X with the desired precision.
653 téléchargements
Mise à jour 3 oct. 2013

Afficher la licence

Rounds the elements of X with the desired precision. Better than similar submissions as it handles arrays, negative and positive precision values, and ceil and floor functionality. It also is very tolerant to different numbers of inputs so it can be used as a direct replacement for round.

%ROUNDX rounds the elements of X with the desired precision
%
% output = roundx(X)
% output = roundx(X, decimalplaces)
% output = roundx(X, decimalplaces, options)
%
% X is the value to be rounded. X can be an array, if desired.
% DECIMALPLACES is the number of decimal places to round to. Also accepts
% 0 and negative values, used to round to desired sig. figs.
% OPTIONS can be 'ceil', 'floor', or 'round' and indicates to the function
% whether to round up, down, or to the closest value, respectively.
% Default is 'round' if excluded.
%
% Author: David Berman (dberm22@gmail.com)

Citation pour cette source

dberm22 (2024). RoundX - Round to desired precision (https://www.mathworks.com/matlabcentral/fileexchange/43745-roundx-round-to-desired-precision), MATLAB Central File Exchange. Récupéré le .

Compatibilité avec les versions de MATLAB
Créé avec R2013a
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux
Catégories
En savoir plus sur Arithmetic Operations dans Help Center et MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Publié le Notes de version
1.0.0.0