how to arrange vector to matrix?
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi guys,
I have a vector: x = [1 2 3 4 5 6]
How to arrange this vector to new matrix, like this:
[1 2 3 4 5 6
2 3 4 5 6 1
3 4 5 6 1 2
4 5 6 1 2 3]
Thanks for your help.
0 Commenti
Risposta accettata
Più risposte (1)
Sudharsana Iyengar
il 6 Nov 2021
You can try using the functions perms. or if you want cyclic permutations
x=[1,2,3,4,5,6];
v=perms(x)
X=[1,2,3,4,5,6];
V=[X;circshift(X,1);circshift(X,2);circshift(X,3);circshift(X,4);circshift(X,5);]
Vedere anche
Categorie
Scopri di più su Image Processing Toolbox 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!