File Exchange

image thumbnail

Round Toward Vector of Values

version 1.8 (2.16 KB) by

Round values towards a given vector of choices.

5 Downloads

Updated

View License

This function will round an inputed matrix, of any size, and round each value towards the vector of choices given. It can also be given a type of round ('floor','fix','ceil','round','away'), and will round toward -inf,0,inf,closes value respectively, or away from 0 respectively.

Comments and Ratings (5)

Chris H

Worked great!

Qinmiao Li

Easy to use. Great thanks!

Leonie

Leonie (view profile)

super grateful for this easy solution!

Josh

Josh (view profile)

Joey

Joey (view profile)

This is excellent

Updates

1.8

Little tweaks for speed

1.5

The function can now round away from 0 (the opposite of floor).

1.2

Fixed problem with round when the number is in between two integers.

MATLAB Release
MATLAB 7.13 (R2011b)
Acknowledgements

Inspired: Round to X

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today