combinations
combinations
combinations
Generate all possible subsets of an array.
combs = combinations(arr)
returns all possible combinations of elements in arr
, for subset lengths ranging from 1 to K, where K is the length of arr
.
Arguments
arr
(vector): Input array of elements.
Returns
combs
(cell array): A cell array where each element is a subset ofarr
with varying lengths (from 1 tolength(arr)
).