rand_unique_pairs(N, pair_num, ordered, self_pair)
This function could be handy for sampling pair-wise correlation from a large number of variables.
Input arguments:
N: defines the range of the numbers (from 1 to N)
pair_num: the number of pairs
ordered: 1 for ordered pairs and 0 for unordered. The default is 0.
self_pair: 1 for allowing self-pair (e.g, 3-3 is a self-pair). The default is 0.
Output argument:
pairs: a 2-by-pair_num matrix with each row containing a unique pair
Cite As
Yifan Gu (2025). rand_unique_pairs(N, pair_num, ordered, self_pair) (https://www.mathworks.com/matlabcentral/fileexchange/61456-rand_unique_pairs-n-pair_num-ordered-self_pair), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- AI and Statistics > Statistics and Machine Learning Toolbox > Regression > Generalized Linear Models > Generalized Linear Regression >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.