could anyone help me how to randomly pair two numbers in each pair.
Ältere Kommentare anzeigen
A=[1:12]
now I want to pair two numbers randomly in each pair as [ 1 3] [ 2 6] [7 9] .....
Could anyobe please help me on this.
4 Kommentare
David Goodmanson
am 9 Nov. 2021
HI jaah,
try randperm(12), that should give you some ideas.
jaah navi
am 9 Nov. 2021
Mathieu NOE
am 9 Nov. 2021
almost there
just add reshape and you're done
N = 12;
a = randperm(N)
b = reshape(a,N/2,2)
a =
6 3 11 7 8 5 1 2 4 9 10 12
b =
6 1
3 2
11 4
7 9
8 10
5 12
jaah navi
am 9 Nov. 2021
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!