Rounding down when doing division in Matlab

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.

 채택된 답변

Arif Hoq
Arif Hoq 2022년 11월 28일
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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

릴리스

R2021b

태그

질문:

2022년 11월 28일

답변:

2022년 11월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by