datasample
statistics: y = datasample (data, k)
statistics: y = datasample (data, k, dim)
statistics: y = datasample (…, Name, Value)
statistics: [y idcs] = datasample (…)
Randomly sample data.
Return k observations randomly sampled from data. data can be a vector or a matrix of any data. When data is a matrix or a n-dimensional array, the samples are the subarrays of size n - 1, taken along the dimension dim. The default value for dim is 1, that is the row vectors when sampling a matrix.
Output y is the returned sampled data. Optional output idcs is the vector of the indices to build y from data.
Additional options are set through pairs of parameter name and value. Available parameters are:
Replacetrue (default) or false: when set
to true, datasample returns data sampled with replacement.WeightsSee also: rand, randi, randperm, randsample
Source Code: datasample