-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
Currently, randsample.m requires categorical vector support for input population argument to be MATLAB compatible, as observed in the docs. This issue proposes adding support and necessary tests to randsample.m as part of the ongoing datatypes integration effort.
Current categorical input seems to have this behavior:
octave:24> C = categorical({'red','blue','green','red','blue','green'});
octave:25> C
C =
1x6 categorical array
red blue green red blue green
octave:26> y = randsample(C, 1)
y =
categorical
red
octave:27> y = randsample(C, 2)
error: randsample: The input k must be a non-negativeinteger. Sampling without replacement needs k <= n.
error: called from
randsample at line 54 column 5
where any k > 1 will raise an error.
Note: string support seems to already be in place, but I did not test extensively. Could also look at that while tackling this issue.
Metadata
Metadata
Assignees
Labels
No labels