How to obtain all possible combinations from n (large) arrays that sum up to a number
2 views (last 30 days)
Show older comments
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
0 Comments
See Also
Categories
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!