Generate large nchoosek in batches?
Show older comments
I would like to generate all possible combinations of a binary vector, I’ve tried using nchoosek and it does what I want it to do, but I run out of memory if I have a k value of more than about 4.
Is there any way that I can put the nchoosek in a loop and trade speed for memory usage by generating the combinations in batches instead of all at once?
Say I need
nchoosek(1:200,5)
is there a clever way to evaluate say the first 20% of the combinations, do what I need to do with them and then throw them away before I generate the next 20% of the nchoosek(1:200,5) sequence?
Thanks.
Accepted Answer
More Answers (1)
Stephen23
on 22 Sep 2016
0 votes
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!