Code covered by the BSD License  

Highlights from
Grouping of 2 function

Grouping of 2 function


Alex Dytso (view profile)


Function that generates all possible groups of 2

%Autorh: Alex Dytso
%Date: 06/12/2012
%Description: This code is a combinatorial sowtware designed to creat
%objects in groups of 2

function G=group(A)

L=length(A);%length of the intput vector

p=1;% index of the vector

for i=1:L-1
    for k=i+1:L % this done so that no elements in the group is the same
        G(p,:)=[A(i),A(k)];% grouping 
        p=p+1;% increamenting index 

Contact us