FUNCTION REFERENCE
nchoosek
Binomial coefficient or all combinations.
Binomial coefficient or all combinations.
Syntax
c = nchoosek(n, k)Syntax
C = nchoosek(v, k)nchoosek(n, k) is the number of ways to choose k of n items.
For a vector v, each row of C is one combination of k elements of v, in
lexicographic order of position.
Example
nchoosek([1 2 3], 2) % [1 2; 1 3; 2 3]Differences from MATLAB: A scalar result above 2^53 is an error instead of an
inexact value with a warning; the matrix form is limited to 16777216 elements;
numeric, logical and character v only.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.