how to create random value matrix with size 3X5?
42 次查看(过去 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 中查找有关 Logical 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!