# Convert a tridimensional array into a cell

1 visualización (últimos 30 días)
Sergio Alejandro Calderon Villanueva el 17 de Feb. de 2021
I have the following problem: I need to convert an array A wit dimensions 4x4x5 into a cel 4x4 where ecah entry is 1x5 using mat2cell or an abrreviated method. I appreciate your help
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

### Respuestas (1)

Deepak Meena el 24 de Feb. de 2021
Hi Sergio,
You can use num2cell.
>> a = ones(4,4,5);
>> p = num2cell(a,3);
>> p
p =
4×4 cell array
{1×1×5 double} {1×1×5 double} {1×1×5 double} {1×1×5 double}
{1×1×5 double} {1×1×5 double} {1×1×5 double} {1×1×5 double}
{1×1×5 double} {1×1×5 double} {1×1×5 double} {1×1×5 double}
{1×1×5 double} {1×1×5 double} {1×1×5 double} {1×1×5 double}
But the size of the cell won't be 1x5 , it would be 1x1x5
Thanks
##### 1 comentarioMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
Sergio Alejandro Calderon Villanueva el 27 de Feb. de 2021
Tnak you for you answer deepak

Iniciar sesión para comentar.

### Categorías

Más información sobre Data Type Conversion 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