What does this vector assignment mean?

2 ビュー (過去 30 日間)
Lucas  Buckels
Lucas Buckels 2017 年 4 月 3 日
回答済み: Thorsten 2017 年 4 月 4 日
diceLeft = 5
dice = []
dice = [dice randi([1,6],1,diceLeft)];

採用された回答

Thorsten
Thorsten 2017 年 4 月 4 日
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.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by