Here is the same code I mentioned for Cartesian product, adapted to work on sets of strings instead of numeric data:
sets = {{'A' 'E'}; % first position
{'B' 'F'}; % second position
{'C' 'G'}}; % third position
[val,~,idx] = cellfun(@unique, sets, 'Uniform',false);
indices = cell(numel(idx),1);
[indices{:}] = ndgrid(idx{:});
cartProd = cellfun(@(ind,v) v(ind(:)), indices, val, 'Uniform',false);
cartProd = vertcat(cartProd{:})';
This will work for any number of sets, each with any number of elements.
The resulting combinations for the example above (one per row):
>> cartProd
cartProd =
'A' 'B' 'C'
'E' 'B' 'C'
'A' 'F' 'C'
'E' 'F' 'C'
'A' 'B' 'G'
'E' 'B' 'G'
'A' 'F' 'G'
'E' 'F' 'G'