Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

randsample (MathScript RT Module Function)

LabVIEW 2012 MathScript RT Module Help

Edition Date: June 2012

Part Number: 373123C-01

»View Product Info
Download Help (Windows Only)

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


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit