rand_unique_pairs(N​, pair_num, ordered, self_pair)

Version 1.2.0.0 (1,64 KB) von Yifan Gu
This function randomly generates unique integer number pairs, either ordered or unordered.
48 Downloads
Aktualisiert 13. Mär 2017

Lizenz anzeigen

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

Zitieren als

Yifan Gu (2024). 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. Abgerufen .

Kompatibilität der MATLAB-Version
Erstellt mit R2006a
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Veröffentlicht Versionshinweise
1.2.0.0

Fix some errors

1.1.0.0

Update the description.

1.0.0.0