Selecting a random element from a matrix with a range.
이전 댓글 표시
I am trying to select a random element from this matrix with a certain range.
d = rand(10)
d(end,randperm(size(d,2), 1))
This creates a 10*10 matrix between 1 and 0. I want to slect a random variable < 0.5 but i am trouble applying this to the code. Any help is much appreciated.
댓글 수: 2
Cedric
2017년 10월 23일
There may not be any element < 0.5. How do you define the number of elements that you will pick? What is the purpose?
Shane McNamara
2017년 10월 24일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 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!