converting randit to randi

조회 수: 3 (최근 30일)
Amna Yousaf
Amna Yousaf 2019년 6월 11일
답변: Dennis 2019년 6월 11일
Randit it obsolete in newer versions of Matlab.
Can anyone guide me how to convert randit(1,1,9) to randi?
  댓글 수: 1
Amna Yousaf
Amna Yousaf 2019년 6월 11일
matrix(i,j)=randit(1,1,9). Please help me convert this to randi.

댓글을 달려면 로그인하십시오.

답변 (2개)

Walter Roberson
Walter Roberson 2019년 6월 11일
https://www.mathworks.com/matlabcentral/answers/376258-what-does-x-randint-1-1-1-n#comment_522862

Dennis
Dennis 2019년 6월 11일
matrix(i,j)=randi(9);
Instead of creating single random numbers in a loop maybe consider creating them as vector/matrix.
matrix=randi(9,10,10); %10x10 matrix with random numbers from 1-9
instead of
matrix=zeros(10,10);
for i=1:10
for j=1:10
matrix(i,j)=randi(9);
end
end

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by