-
1 Comment
Payam Morsali
on 3 Nov 2019
why this isn't working here?
it works on my laptop;
function ind = subset_sum(v,n)
k=dec2bin(0:2^length(v)-1);
b=k.*v;
l=find(sum(b')==n);
m=k(l,:).*(1:length(v));
ind=m(m>0);
end
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!