Rounding down when doing division in Matlab

3 visualizaciones (últimos 30 días)
L'O.G.
L'O.G. el 28 de Nov. de 2022
Respondida: Arif Hoq el 28 de Nov. de 2022
How do you round when dividing such that
1/7 = 1
2/7 = 1
...
7/7 = 1
8/7 = 2
...
14/7 = 2
15/7 = 3
etc.

Respuesta aceptada

Arif Hoq
Arif Hoq el 28 de Nov. de 2022
use ceil function:
a=ceil(1/7)
a = 1
b=ceil(2/7)
b = 1
c=ceil(7/7)
c = 1
d=ceil(8/7)
d = 2

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by