Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
could anyone tell me how to group the combinations under the condition that the same number should not be repeated again.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
code: c = combnk(1:4,2)
If i run it i am getting c =
3 4
2 4
2 3
1 4
1 3
1 2
could anyone help me how to group the numbers say for example (34,12),(24,13) and (23,14) in the following way.
0 comentarios
Respuestas (2)
KSSV
el 23 de Mzo. de 2018
c = combnk(1:4,2) ;
N = sum(c.*[10 1],2) ;
iwant = [N(1:3) N(length(N):-1:4)]
7 comentarios
Rik
el 24 de Mzo. de 2018
Editada: Rik
el 24 de Mzo. de 2018
The code below is the same as the code by KSSV, but without the need for implicit expansion.
c = combnk(1:4,2);
N = c * [10;1];
iwant = [N(1:3) N(length(N):-1:4)];
4 comentarios
Walter Roberson
el 26 de Mzo. de 2018
Your question ends with "in the following way." without an example of the output you want.
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!