Hi hassan,
My understanding of your question is that you want a way to find all combinations/sets of four elements where each set has exactly one element from (super) sets A, B, C, and D. Given the sizes of sets A through D, then I expect there to be 6*5*4*4=480 different subsets. Probably the easiest way to do this (and not necessarily the most efficient) is to have four loops, one within the other, and combine all possible sets:
next=1;
for i=1:length(A)
for j=1:length(B)
for k=1:length(C)
for m=1:length(D)
allcombos(next) = ???; % some combination of the data in A,B,C,and D
next=next+1;
end
end
end
end
The above is just an example - allcombos could be a cell array or a matrix of 480 rows by whatever number of columns, it all depends on how you want to store the data. A fancier solution would be to recurse on a subset of the data and concatenate sets as you go. This would probably allow more flexibility especially if your requirement changes to say only choose three elements from the four sets of data.
Geoff