DICE: launch N times

1 次查看(过去 30 天)
Marco Castelli
Marco Castelli 2017-2-14
回答: Torsten 2017-2-14
I get N dice of which each face has a number from 1 to 6. I'd like representing all the possibility with a matrix in which each column contains the N value of the dice.
Can you help me to write a script to do this task using only function in the Matlab suite and not other toolbox?
Thanks Marco

回答(2 个)

Ahmad Moniri
Ahmad Moniri 2017-2-14
I think you should look at the combntns function.
https://uk.mathworks.com/help/map/ref/combntns.html
  1 个评论
Marco Castelli
Marco Castelli 2017-2-14
This function should be exactly what I'm looking for if it wasn't inside the Mapping Toolbox

请先登录,再进行评论。


Torsten
Torsten 2017-2-14
https://de.mathworks.com/matlabcentral/fileexchange/24325-combinator-combinations-and-permutations
N=...;
combinator(6,N,'p','r');
Best wishes
Torsten.

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by