AllCombIter

A iterative version of function allcomb, which compute all of the combinations of the elements of numbers of arrays.

You are now following this Submission

An iterative approach to compute all the combinations amnong undetermined number of 1D arrays.
Mr. Jos (https://www.mathworks.com/matlabcentral/fileexchange/10064-allcomb-varargin) supplied a function `allcomb` which compute combinations of several arrays.
While the `allcomb` function return all of the combinations in a matrix form at once, it may crash when the number of combinations reachs a high level (i.e. run out of memeory).
A iterative version of `allcomb` is design to be a iterator-like object, it only return one combination when the method `next()` is called.
Notice that, it only compute the comb of 1D arrays!
Technically, it use a recursive approach in place of an undetermined nested of for-loop
Example:
A_range = 0:2:6;
B_range = 0:2:4;
C_range = 1:2;
iter = AllCombIter(A_range, B_range, C_range);
cmb = [];
while iter.hasNext()
comb = iter.next();
cmb = [cmb; comb];
end

Cite As

一平 左 (2026). AllCombIter (https://www.mathworks.com/matlabcentral/fileexchange/89117-allcombiter), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.0.0