How to check divisibility?

조회 수: 359 (최근 30일)
Caped Crusader
Caped Crusader 2013년 1월 20일
답변: Jitesh Kumar 2018년 9월 25일
Hi, I need to check whether two numbers are divisible or not. But how can I do that in Matlab? e.g. Matlab gives 1.5 for 3/2 but I need to get 3/2 = 0 and 4/2 =2.

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 1월 20일
편집: Azzi Abdelmalek 2013년 1월 20일
a=3;
b=2;
out=~rem(a,b)*a/b
  댓글 수: 4
Caped Crusader
Caped Crusader 2013년 1월 20일
Thanks ,it works!
Caped Crusader
Caped Crusader 2013년 1월 20일
However, I used rem(a,b) format after checking the help files and it worked. Anyway thank you very much.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Jitesh Kumar
Jitesh Kumar 2018년 9월 25일
a=5; b=1; rem(a,b)=4

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by