nCtwo

All combinations of N elements taken two at the time.

You are now following this Submission

Usage - vec=nCtwo(dat) where dat is a vector of length N, produces a matrix with N*(N-1)/2 rows and 2 columns. Each row of the result vec has two of the elements in the vector dat. Similar to the MATLAB function NCHOOSEK(dat,2) but much faster.

Cite As

Simone Scaringi (2026). nCtwo (https://ch.mathworks.com/matlabcentral/fileexchange/20110-nctwo), MATLAB Central File Exchange. Retrieved .

Acknowledgements

Inspired: nchoose2, VChooseK

Categories

Find more on Linear Algebra in Help Center and MATLAB Answers

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.0.0.0