randomly selecting an element without randsample

2 ビュー (過去 30 日間)
cgo
cgo 2021 年 4 月 23 日
回答済み: Walter Roberson 2021 年 4 月 23 日
How do I randomly select an element without the machine learning toolbox function randsample?

採用された回答

Walter Roberson
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 件)

カテゴリ

Help Center および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by