ceil

Returns the smallest integer that is greater than or equal to x.

ceil(x)

Inputs

x
Any valid scalar | string | vector | matrix
Type: double | integer | char | string | logical | struct | cell
Dimension: scalar | string | vector | matrix

R
scalar | matrix

Examples

Since x = 0.1, the smallest integer greather than or equal to x is 1:

ceil(0.1)
ans = 1

Matrix example. The ceiling of each element is returned in a matrix of the same dimensions:

x = [2.3 3.6; 4.1 5.7]
ceil(x)
ans = [ 3 4 ; 5 6 ]

Complex example. Notice that the ceiling of both the real and imaginary part is taken and returned as a complex number:

x = complex(2.3,3.5)
ceil(x)
ans = 3 + 4i