필터 지우기
필터 지우기

What does this vector assignment mean?

조회 수: 1 (최근 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 CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by