Next integer greater than but not equal to input

Viewed 149

Is there a (Matlab) function similar to ceil to find the next integer that is greater than the input but not equal to the input?

Examples:

1.1 --> 2
1.9 --> 2
2.0 --> 3    (note that ceil(2) == 2)
2.1 --> 3

I tried with ceil(x+eps), but that only works for small numbers:

>> ceil((-4:4)+eps)

ans =

-4    -3    -1     0     1     2     2     3     4

Also, any equivalent for floor?

2 Answers
Related