how to get combination of elements in a matrix in pair order
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
SANJOY MONDAL
il 11 Lug 2019
Commentato: SANJOY MONDAL
il 11 Lug 2019
I have a matrix A=[3 5 6 7 8]
i want the output in the form B= [ 3 5
3 6
3 7
3 8
5 3
5 6
5 7
5 8...] like this
0 Commenti
Risposta accettata
Più risposte (1)
Andrei Bobrov
il 11 Lug 2019
Modificato: Andrei Bobrov
il 11 Lug 2019
A=[3 5 6 7 8];
[y,x] = ndgrid(A);
B = [x(:),y(:)];
B = B(diff(B,1,2) ~= 0,:);
0 Commenti
Vedere anche
Categorie
Scopri di più su Matrices and Arrays in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!