Random combination between 2 arrays
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Raj Arora
am 8 Sep. 2021
Kommentiert: Raj Arora
am 8 Sep. 2021
Suppose I have 2 arrays
X1 = 2.23 2.90 3.04 3.81
X2 = 0.51 0.55 0.61 1.5
Now I have to make the random combination of both these arrays(X1 & X2) such that the element must not repeat like the one given below
(2.23, 0.55); (2.90, 1.5); (3.04, 0.61); (3.81, 0.5)
Thanks in advance..
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 8 Sep. 2021
X1 = [2.23 2.90 3.04 3.81];
X2 = [0.51 0.55 0.61 1.5];
output = [X1(randperm(4)); X2(randperm(4))].'
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!