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!