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 ExchangeMATLAB についてさらに検索

タグ

質問済み:

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