roundfrac

Round numbers to nearest fraction.
450 download
Aggiornato 6 gen 2015

Visualizza la licenza

This function rounds inputs to multiples of a fraction. For example, to round values in an array x to the nearest fifth, use roundfrac(x,1/5).

Syntax
Xrounded = roundfrac(X,fraction)
Xrounded = roundfrac(X,fraction,option)

Description
Xrounded = roundfrac(X,fraction) rounds X to multiples of nearest fraction. If fraction is a scalar, it is applied to all values in X. If dimensions of fraction match dimensions of X, it is applied element-wise. If fraction is 1/3, values of X are rounded to the nearest one third. roundfrac(X,1) is equivalent to round(X).

Xrounded = roundfrac(X,fraction,option) specifies an option string as 'floor', 'ceil', 'fix', or 'round'. Default rounding option is 'round'.

Cita come

Chad Greene (2024). roundfrac (https://www.mathworks.com/matlabcentral/fileexchange/48965-roundfrac), MATLAB Central File Exchange. Recuperato .

Compatibilità della release di MATLAB
Creato con R2012b
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Categorie
Scopri di più su Arithmetic Operations in Help Center e MATLAB Answers

Community Treasure Hunt

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

Start Hunting!

roundfrac/html/

Versione Pubblicato Note della release
1.0.0.0