MATLAB: Find different combinations of splitting a vector

matrix manipulation

having a vector V, how can i find the different ways to split this vector v into subvectors such that the sum of each subvector does not exceed limit K

Best Answer

try
nchoosek(V,1)
nchoosek(V,2)
% ...
nchoosek(V,8)