Borrar filtros
Borrar filtros

How to divide the column data into variable length?

2 visualizaciones (últimos 30 días)
kitty varghese
kitty varghese el 28 de Nov. de 2018
Editada: TADA el 28 de Nov. de 2018
I have a column vector of size A=20. I want to divide this column vector into 5 smaller vector of size 5,4,3,6 and 2. Such that a1 is of size 5x1,a2 size=4x1 and so on.

Respuesta aceptada

TADA
TADA el 28 de Nov. de 2018
Editada: TADA el 28 de Nov. de 2018
a = rand(20,1);
c = mat2cell(a, [5,4,3,6,2], 1);
  2 comentarios
kitty varghese
kitty varghese el 28 de Nov. de 2018
I am getting the following error
Input arguments, D1 through D2, should be vectors.
TADA
TADA el 28 de Nov. de 2018
Editada: TADA el 28 de Nov. de 2018
yes, I wrote it wrong at first,
should work fine now.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Multidimensional Arrays 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