What does this vector assignment mean?

1 visualización (últimos 30 días)
Lucas  Buckels
Lucas Buckels el 3 de Abr. de 2017
Respondida: Thorsten el 4 de Abr. de 2017
diceLeft = 5
dice = []
dice = [dice randi([1,6],1,diceLeft)];

Respuesta aceptada

Thorsten
Thorsten el 4 de Abr. de 2017
That's easy:
randi([1,6],1,diceLeft)
generates a 1 x diceLeft matrix of random integer values from the interval [1,6].
For the first call of
dice = [dice randi([1,6],1,diceLeft)];
when dice is empty, you get these diceLeft numbers; for subsequent calls of
dice = [dice randi([1,6],1,diceLeft)];
you add diceLeft new random numbers.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by