I would like to randomly choose elements from a finite set that contains both numbers and NaNs while seeding the random number generation procedure.
So far I can make it work without seeding:
data = [0, 1, 2, 3, 4, 5, nan];
sample = datasample(data, 50);
but if I want to seed the number generation:
seed = rng(100);
sample = datasample(seed, data, 50);
I get the following error:
Error using datasample (line 89)
Sample size K must be a non-negative integer.
even if the syntax for datasample is (*):
[y,...] = datasample(s,data,k,...)
I have tried using randsample, too, but I get similar results.
Aucun commentaire:
Enregistrer un commentaire