This is an awesome piece of code!
Although i have an request, like say when I have a 5 or more large vectors (eg.,-200:200) i encounter memory problems.
I was thinking like,
1) check the maximum variable size for the particular computer.
2) if the size of the generated variable is more than the maximum size permitted store the intermediate result in a "mat" file. clear the contents of the variable and append the successive results to the end of the "mat" file

say if i have vectors like these
q1 = -40:dq:40;
q2 = -175:dq:0;
q3 = -250:dq:15;
q4 = -200:dq:200;
q5 = -40:dq:40;

how do i find all possible combination
Q = combination(q1,q2,q3,q4,q5);

the solution exist only if i choose dq >= 7
when i used the "allcomb" from FEX
or during for loop pre-allocation using the product of the length of the vectors

i'm looking for all possible combinations i.e., dq = 1, which for the above cases i get memory problems

your code looks promising except i dont know how to use them.