how do you increment a count and repeat a code multiple times
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
0 Kommentare
Antworten (1)
lvn
am 2 Apr. 2014
Bearbeitet: lvn
am 2 Apr. 2014
For random numbers between 0 and 10
count1=0; count2=0;
for p=1:10000
a1=round(rand(1)*10);
b1=round(rand(1)*10);
b2=round(rand(1)*10);
if b1==a1
count1=count1+1;
end;
if b2==a1
count2=count2+1;
end;
end
count1
count2
output:
count1 =
920
count2 =
981
0 Kommentare
Siehe auch
Kategorien
Mehr zu Biological and Health Sciences finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!