-
1 Comment
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
Suggested Problems
72121 Solvers
13943 Solvers
What is the next step in Conway's Life?
1008 Solvers
2195 Solvers
Sum the numbers on the main diagonal
解决508
More from this Author95
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!