Difficult matlab question, working with arrays.

4 ビュー (過去 30 日間)
Nick Haufler
Nick Haufler 2015 年 9 月 30 日
編集済み: Image Analyst 2015 年 9 月 30 日
In the attached question it talks about determining if the outcome of the dice rolls is a pair, three, four or five of a kind. How would you do that, would you make a vector, and then use if statements. I included my script for you to look at:

採用された回答

Image Analyst
Image Analyst 2015 年 9 月 30 日
編集済み: Image Analyst 2015 年 9 月 30 日
Nick, take a look any() and your own histogram, "counts", and check if any of the bins have 3 or 4 in them.
if any(counts == 3)
elseif any(counts == 4)
elseif any(counts == 5)
end
There are other ways also. I'm not sure why you took counts out of the loop but you'll have to put it back in.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by