find different combinations of splitting a vector

1 visualización (últimos 30 días)
Elysi Cochin
Elysi Cochin el 23 de Mzo. de 2020
Editada: Elysi Cochin el 25 de Mzo. de 2020
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
  1 comentario
John D'Errico
John D'Errico el 23 de Mzo. de 2020
This question is so wildly vague as to be virtually impossible to give an intelligent answer.
What is the real vector length that your REAL problem has? Often the answer is hundreds or thousands of elements, in which case the answer is tyou don't have a large enough computer.
Are there replicate elements in the vector?
Does order matter?
Must each segment be as large as possible?
Lots of other questions that are left unresolved.

Iniciar sesión para comentar.

Respuesta aceptada

Fangjun Jiang
Fangjun Jiang el 23 de Mzo. de 2020
Editada: Fangjun Jiang el 23 de Mzo. de 2020
try
nchoosek(V,1)
nchoosek(V,2)
% ...
nchoosek(V,8)

Más respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by