Maybe something like this , I ran it but it clogged up the memory:
function result = monte(p,q) % p is number of series, q is number of experiments
for i=1:q
while i<p
dice = ceil(6*rand(5,1));
A=(dice.*(dice~=mode(dice)));
k=1;
while...
Hi, thanks for the tip, this is what I ended up with:
dice = ceil(6*rand(5,1));
disp(dice);
count = hist(dice, [1,2,3,4,5,6]);
disp(count);
disp(mode(dice));
A=(dice.*(dice~=mode(dice)));
disp(A);
k=1;
while any(dice.*(dice~=mode(dice)))~=0...
Hi again, I solved the problem with the mode-function. Regarding the loop part, how is the while-statement suppose to look? I have a counter k=1 and I have a condition dice~=mode(dice) but how are these supposed to fit together , I wrote:
while dice.*(dice~=mode(dice))~=[0,0,0,0,0]
...
Hi, I ran the code you gave me but it seems like the mode-function is abscent with my version, I ran 'help mode' in the prompt but it replies 'mode.m not found' . I have tried both Matlab version 6 and 7. Maybe I need to download extention packs for MATLAB or so?
I'm making a simple dice-game with MATLAB and I
want to extend the functions of it. What I have now is
that I throw 5 dices (each dice gives a value of 1 to
6), and I make MATLAB display the value of each dice,
e.g [1 3 5 2 1] and count how many of each value are
represented e.g in my case...