randsample (MathScript RT Module Function)

LabVIEW 2012 MathScript RT模块帮助

版本日期:June 2012

产品编号:373123C-0118

»查看产品信息
下载帮助
(仅限Windows)

Owning Class: statistics

Requires: MathScript RT Module

Syntax

y = randsample(v, k)

y = randsample(v, k, r)

y = randsample(v, k, true, w)

Description

Returns a vector with elements that are uniformly sampled from a set.

Examples

Inputs

Name Description
v Specifies the set that is uniformly sampled to form the output. v is a vector or positive integer that means the vector 1:v.
k Specifies the length of the output vector.
r Specifies whether each element in v can be sampled more than once. The default is false.
w Specifies the weights for the elements in v. w is a real vector with the same length as v. You can only specify w when r is true.

Outputs

Name Description
y Returns the vector with elements that are uniformly sampled from v.

Details

The following table lists the support characteristics of this function.

Supported in the LabVIEW Run-Time Engine Yes
Supported on RT targets Yes
Suitable for bounded execution times on RT Not characterized

Examples

V = 'National Instruments';
Y = randsample(V, 6);

Related Topics

rand
randnormal
random
randpermutation

文章是否对您有帮助?

没有帮助