I have a 1-dimensional cell array Z. Each cell of Z contains a vector. For example:
Z{1} = [1 2];
Z{2} = [3 4 5];
Z{3} = [6];
...
Z{length(Z)} = [10 11 12 13];
The sizes of those vectors are all different. What I want to do is to compare the sum of functions values of all possible combinations with one element from each Z{i}. That is I want to compare all the following combinations:
func(1) + func(3) + func(6) + ...
func(1) + func(4) + func(6) + ...
func(1) + func(5) + func(6) + ...
func(2) + func(3) + func(6) + ...
func(2) + func(4) + func(6) + ...
func(2) + func(5) + func(6) + ...
...
...
and I want to know which combination yields the maximum.
How can I smartly do this? The smarter, the better. But I am also looking for any working code. The problem size will be small.
Note: The actual values used in this example, 1, 2, 3, 4, 5, 6, ... are just examples. They don't have any specific pattern.