How to obtain all possible combinations from n (large) arrays that sum up to a number

Hi,
I am trying to find a code that would efficiently find all combinations from n (large) arrays that would sum up to a particular value. for example:
a=[1:100];
b=[1:100];
c=[1:150];
d=[1:100];
e=[1:100];
all combinations from the above 5 arrays that would sum up to 400 and obtain results in the following format:
[100 100 100 100 0
0 100 100 100 100
100 0 100 100 100]
Thanks,
Maz

Categories

Asked:

on 30 Nov 2015

Edited:

on 30 Nov 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!