randomly selecting an element without randsample
조회 수: 5 (최근 30일)
이전 댓글 표시
How do I randomly select an element without the machine learning toolbox function randsample?
댓글 수: 0
채택된 답변
Walter Roberson
2021년 4월 23일
YourData(randi(numel(YourData), SIZE)) %select SIZE elements WITH REPETITION
YourData(randperm(numel(YourData), NUMBER)) %select NUMBER elements WITHOUT REPETITION
SIZE can be a vector of values such as [5 7] to generate a 5 x 7 matrix with repetition.
NUMBER must be a positive integer scalar; reshape() afterwards if you need to.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!