I have an array of values and I am trying to round them all to integers, but I don't want any of them to become zeros.
Some of the values look like this:
0.00001
-0.03
-0.000001
0.789
1
I would like the result after the rounding to look like this:
1
-1
-1
1
1
I tried round(), ceil(), floor(), etc. but I'm not sure what to do in this case. Any advice?
Copyright Notice:Content Author:「Veridian」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/40901120/matlab-round-values-such-that-none-are-zero