New to mablab and need some basic help!
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Daniel Hodgson
el 3 de Feb. de 2020
Comentada: Star Strider
el 3 de Feb. de 2020
I need to make a dice with riged odds and plot the results in a bar chart. The dice and the riged odds part gives me the result im seeking, but i dont know how to convert these anwsers into a bar chart seeming my x- values keeps on changing value.
clc, clear all
for index=(1:1000)
x=randi([1,13]);
if x==1
x=5
elseif 2<=x && x<=5
x=randi([1,2])
elseif 6<=x && x<=7
x=4
elseif 8<=x && x<=9
x=6
elseif 10<=x && x<=13
x=3
end
end
Thanks
0 comentarios
Respuesta aceptada
Más respuestas (2)
Dave
el 3 de Feb. de 2020
Consider creating an empty matrix prior to the 'for' statement. Then write the results to that matrix.
Dave
el 3 de Feb. de 2020
If you haven't already solved this, search for something like "creating arrays with loops". That should give you some examples on how to proceed.
0 comentarios
Ver también
Categorías
Más información sobre Loops and Conditional Statements en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!