ceil
Round toward positive infinity
Description
Examples
Round Matrix Elements Toward Positive Infinity
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 Duration Values Toward Positive Infinity
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 Arguments
X
— Input array
scalar | vector | matrix | multidimensional array | table | timetable
Input array, specified as a scalar, vector, matrix, multidimensional array, table, or
timetable. For complex X
, ceil
treats
the real and imaginary parts independently.
ceil
converts logical and char
elements
of X
into double
values.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| char
| logical
| table
| timetable
Complex Number Support: Yes
t
— Input duration
duration
array
Input duration, specified as a duration
array.
unit
— Unit of time
'seconds'
(default) | '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.
Extended Capabilities
Tall Arrays
Calculate with arrays that have more rows than fit in memory.
The
ceil
function fully supports tall arrays. For more information,
see Tall Arrays.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.
Thread-Based Environment
Run code in the background using MATLAB® backgroundPool
or accelerate code with Parallel Computing Toolbox™ ThreadPool
.
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
GPU Arrays
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
The ceil
function
fully supports GPU arrays. To run the function on a GPU, specify the input data as a gpuArray
(Parallel Computing Toolbox). For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Distributed Arrays
Partition large arrays across the combined memory of your cluster using Parallel Computing Toolbox™.
This function fully supports distributed arrays. For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).
Version History
Introduced before R2006aR2023a: Perform calculations directly on tables and timetables
The ceil
function can calculate on all variables within a table or
timetable without indexing to access those variables. All variables must have data types
that support the calculation. For more information, see Direct Calculations on Tables and Timetables.
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)