Create a matrix with random integers between 1 and 9
조회 수: 12 (최근 30일)
이전 댓글 표시
Hello.
I need help creating a 3x3 matrix.
I need to create a matrix of integers between 1 and 9 allocated randomly each time and without repeating the same number.
Here's an example:
matrix =
9 7 3
5 1 8
4 2 6
Thanks!
댓글 수: 0
채택된 답변
추가 답변 (1개)
Andrei Bobrov
2019년 5월 14일
편집: Andrei Bobrov
2019년 5월 14일
[~,ii] = sort(rand(9,1));
out = reshape(ii,3,3);
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!