How to create a random array from an array
이전 댓글 표시
Hello every one
I have a 1x450 array and I want to choose 300 elements of this array randomly and create a new array with random elements
I tried randi and randperm but these two didn't give me the answer I want
What should I use instead
Thanks in advance
댓글 수: 2
Dyuman Joshi
2023년 2월 16일
What did you try?
Do you want 300 different indices? or 300 indices with repetitions works?
Jan
2023년 2월 16일
randi creates indices with repetitions, randperm without. If both methods are not working for you, the problem is hidden inside "didn't give me the answer I want". The readers cannot guess, what you have exactly tried and what you want. So please post your code and explain, what you want to change.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Number Theory에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!