Table Of Contents

randsample

Version:
    Last Modified: March 15, 2017

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

    Syntax

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

    Inputs

    v

    Set that is uniformly sampled to form the output. v is a vector or positive integer that means the vector 1:v.

    k

    Length of the output vector.

    r

    Specifies whether each element in v can be sampled more than once.

    Default: false

    w

    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

    y

    Vector with elements that are uniformly sampled from v.

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

    Where This Node Can Run:

    Desktop OS: Windows

    FPGA: This product does not support FPGA devices


    Recently Viewed Topics