Round toward positive infinity
Y = ceil(X)
Y = ceil(t)
Y = ceil(t,unit)
example
Y = ceil(X) rounds each element of X to the nearest integer greater than or equal to that element.
X
Y = ceil(t) rounds each element of the duration array t to the nearest number of seconds greater than or equal to that element.
t
duration
Y = ceil(t,unit) rounds each element of t to the nearest number of the specified unit of time greater than or equal to that element.
unit
collapse all
X = [-1.9 -0.2 3.4; 5.6 7 2.4+3.6i]; Y = ceil(X)
Y = 2×3 complex -1.0000 + 0.0000i 0.0000 + 0.0000i 4.0000 + 0.0000i 6.0000 + 0.0000i 7.0000 + 0.0000i 3.0000 + 4.0000i
Round each value in a duration array to the nearest number of seconds greater than or equal to that value.
t = hours(8) + minutes(29:31) + seconds(1.23); t.Format = 'hh:mm:ss.SS'
t = 1x3 duration 08:29:01.23 08:30:01.23 08:31:01.23
Y1 = ceil(t)
Y1 = 1x3 duration 08:29:02.00 08:30:02.00 08:31:02.00
Round each value in t to the nearest number of hours greater than or equal to that value.
Y2 = ceil(t,'hours')
Y2 = 1x3 duration 09:00:00.00 09:00:00.00 09:00:00.00
Input array, specified as a scalar, vector, matrix, or multidimensional array. For complex X, ceil treats the real and imaginary parts independently.
ceil
ceil converts logical and char elements of X into double values.
char
double
Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | char | logical Complex Number Support: Yes
single
int8
int16
int32
int64
uint8
uint16
uint32
uint64
logical
Input duration, specified as a duration array.
'seconds'
'minutes'
'hours'
'days'
'years'
Unit of time, specified as 'seconds', 'minutes', 'hours', 'days', or 'years'. A duration of 1 year is equal to exactly 365.2425 24-hour days.
This function fully supports tall arrays. For more information, see Tall Arrays.
Usage notes and limitations:
Code generation does not support char or logical data types for X.
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
This function fully supports distributed arrays. For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).
fix | floor | round
fix
floor
round
You have a modified version of this example. Do you want to open this example with your edits?