From: Frank Sabouri on
There is a matrix, in which size of matrix is 8-by-9. By combinatorics, I could have 8C6 = 28 different ways of picking six conditions randomly from a group of eight. Indeed, X is a data matrix and I tried to generate 28 different sub-matrices (subsets of the data), a(i). As you can see, I chose these two functions “nchoosek” and “orderby” to create these 28 different sub-matrices:

dim = 1;
nk = nchoosek (1:8,6);
[aa, bb]=size (nk);
a = zeros (6, 9, aa);
for i = 1:aa,
nk(i) = nk (i,:);
a (i) = orderby (X, nk(i), dim);
end

I also need to extend this script, wherein I would use “pdist” function for any given sub-matrix and extract 28 different vectors that are Euclidean distances as an output of “pdist” function. May somebody show me where the problem is to generate these sub-matrices and how I could complete it to create Euclidean distances.