hi,
I have an 4 x 4 matrix. i need to make permutation for that matrix. The result should be 24 x 4 matrix.
how to permute the matrix....?

 Respuesta aceptada

KSSV
KSSV el 23 de En. de 2019

1 voto

Read about perms and nchoosek.

7 comentarios

msr16
msr16 el 23 de En. de 2019
i have matrix in the form of .csv nchoosek can take the .csv file as input....?
KSSV
KSSV el 23 de En. de 2019
Load the data into MATLAB workspace using csvread or xlsread or readtable and use nchoosek
msr16
msr16 el 23 de En. de 2019
v= csvread('file name')
c= nchoosek(v, 4)
i use this to find permutation but it shows the error.
This i my csv file(TSP10.csv)
im stuck here please help me to find the permutation of matrix in csv file.
KSSV
KSSV el 23 de En. de 2019
A = csvread('TSP10.csv') ;
c= nchoosek(A(:), 4)
msr16
msr16 el 23 de En. de 2019
it works but it gives 1820 x 4 matrix as result
my result should be in 24 x 4 and without repetation
expected result,
1234
1243
1324
1342
1423
1432
2143
2134
2314
2341
2413
2431
3124
3142
3214
3241
3421
3412
4123
4132
4213
4231
4321
4312
Walter Roberson
Walter Roberson el 23 de En. de 2019
Your result should not be 24 x 4!!
24 x 4 would be for permuting 4 entries, but you have 16 entries.
msr16
msr16 el 23 de En. de 2019
Editada: msr16 el 23 de En. de 2019
it may useful for me thank you

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Preguntada:

el 23 de En. de 2019

Editada:

el 23 de En. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by