How to simplify
while or (mod(i,2) == 0, mod(i,3) == 0, mod(i,5) == 0, mod(i,7) == 0, mod(i,11) == 0)
Its like (mod(i, 2 or 3 or 5 or 7 or 11 )) == 0

 채택된 답변

Matt J
Matt J 2022년 10월 13일
편집: Matt J 2022년 10월 13일

0 개 추천

i=4;
any(mod(i,[2,3,7,11])==0)
ans = logical
1

추가 답변 (0개)

카테고리

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

태그

질문:

2022년 10월 13일

편집:

2022년 10월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by