how to create random value matrix with size 3X5?
    조회 수: 44 (최근 30일)
  
       이전 댓글 표시
    
 my question is to create 3x5 matrix add its elemet is radomly from 1-10.
댓글 수: 0
답변 (2개)
  Ayush Singh
      
 2022년 6월 18일
        Hi SEID 
From my understanding of your question I assume you want to create 3*5 matrix of random numbers from 1-10
You can use the 'randi' function ( Uniformly distributed pseudorandom integers ) in folllowing way-
mat = randi(10,3,5)   % 3,5 is the size of the matrix and 10 is the upper range for the matrix elements.
댓글 수: 0
  DGM
      
      
 2022년 6월 18일
        If the numbers are supposed to be integers:
A = randi([1 10],3,5)
otherwise, if the numbers can be any value in the specified interval:
A = rand(3,5)*9+1
댓글 수: 0
참고 항목
카테고리
				Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
			
	제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


