Originally Posted by

**deniselim17** I have 10 integers.

I want to perform certain operations using any 4 integers.

Example, given integers 5,8,8,3,4,0,9,2,2,3.

I want to find 4 integers from the 10 integers given above such that the sum of the 4 integers is equal to 24.

9+8+3+4=24

It looks like $\displaystyle 10C_{4}$. If I use if-else, the program will be very very long. I just wonder is there any built-in function can help me.

Code:

a=[5,8,8,3,4,0,9,2,2,3];
for i1=1:10
for i2=i1+1:10
for i3=i2+1:10
for i4=i3+1:10
do whatever with a(i1),a(i2),a(i3),a(i4)
end
end
end
end

CB