Pairwise comparision matrix considering a permutation
    4 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Dan Ibarra
 el 27 de Abr. de 2021
  
    
    
    
    
    Comentada: Dan Ibarra
 el 29 de Abr. de 2021
            With the following code 
A=[2    3; 
   4    7; 
   5    4; 
   2    1];
idx = nchoosek(1:size(A, 1), 2);
B   = A(idx(:, 1), :) - A(idx(:, 2), :)
I get: 
B = 6×2
    -2    -4
    -3    -1
     0     2
    -1     3
     2     6
     3     3
But, how can I get a comparision for a rows permutation? Not combination. 
0 comentarios
Respuesta aceptada
  Hyeokjin Jho
      
 el 28 de Abr. de 2021
        A=[2    3; 
   4    7; 
   5    4; 
   2    1];
len = size(A,1);
idx(:,1) = repelem(1:len,len);
idx(:,2) = repmat(1:len,1,4);
B   = A(idx(:, 1), :) - A(idx(:, 2), :)
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

