How to split a vector in many sub-vectors with different sizes ?

3 visualizaciones (últimos 30 días)
Rachel Sabioni
Rachel Sabioni el 20 de Mzo. de 2019
Comentada: Rachel Sabioni el 20 de Mzo. de 2019
Hello,
I have a vector and I want to split it in many subvectors with different sizes.
Example:
A = [1 2 3 4 5 6 7 8 9 10]
sub_1 = [1 2 3]
sub_2 = [4]
sub_3 = [5 6]
sub_4 = [7 8 9 10]
Could you help me with that ?
Thanks in advance,

Respuestas (1)

madhan ravi
madhan ravi el 20 de Mzo. de 2019
Sub=mat2cell(A,1,[3,1,2,4]);
Sub{:}

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by