MATLAB - matrix combinations

I am new to MATLAB and am having trouble finding an effective solution to the problem. Any help would be greatly appreciated!

I have a 2D matrix containing various angles between rows that look like

            L1  L2 L3 L4 L5 L6
         L1  0  40 90 0  10 0 
         L2  40 0  0  5  40 20 
         L3  90 0  0  45 0  10 
         L4  0  5  45 0  10 15 
         L5  10 40 0  10 0  15 
         L6  0  20 10 15 15 0

Note that each corresponding column / row is identical. I need to find all possible combinations that lines could be organized in the matrix. those. L1 L2 L3 L4 L5 L6, L1 L2 L3 L4 L6 L5, L1 L2 L3 L5 L6 L4, etc. I need to create a matrix for each combination, which will be later compared with the values โ€‹โ€‹of the template.

I tried to use

p = perms(1:6);
tp = angles( p, : );

to just change the rows of the matrix for each combination. This works fine, except that for each combination, only the rows are interchanged, when the column also needs to be interchanged.

             L1 L2 L3 L4 L5 L6                 L1 L2 L3 L4 L6 L5
         L1  0  40 90 0  10 0              L1  0  40 90 0  0  10 
         L2  40 0  0  5  40 20             L2  40 0  0  5  20 40 
         L3  90 0  0  45 0  10  should be  L3  90 0  0  45 10 0 
         L4  0  5  45 0  10 15             L4  0  5  45 0  15 10
         L6  0  20 10 15 15 0              L6  0  20 10 15 0  15
         L5  10 40 0  10 0  15             L5  10 40 0  10 0  0
+3
1

num tp = angles(p(num,:),p(num,:)), [1 2 3 4 6 5]:

tp =

     0    40    90     0     0    10
    40     0     0     5    20    40
    90     0     0    45    10     0
     0     5    45     0    15    10
     0    20    10    15     0    15
    10    40     0    10    15     0

, . " " , .

+3

Source: https://habr.com/ru/post/1734656/


All Articles