include a maximum and minimum value to 'randr()' function
显示 更早的评论
Hello , my question is simple i need to random values that have certain conditions/limits , i looked on the help manual and it doesn'T say if it's possible with the randr() function
if no , is there another function i can use for that purpose ?
PS : i'm using at as matrix with lines and culumns
1 个评论
回答(1 个)
I don't know what randr() is, but consider uniform random numbers between [5 5.2];
using rand:
x = 5 + rand([1 10])*(5.2-5)
or using the attached file:
x = randrange([5 5.2],[1 10])
For integers, you can use randi(), as Yazan suggests.
类别
在 帮助中心 和 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!