# Convert a tridimensional array into a cell

1 ビュー (過去 30 日間)
Sergio Alejandro Calderon Villanueva 2021 年 2 月 17 日
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

サインインしてコメントする。

### 回答 (1 件)

Deepak Meena 2021 年 2 月 24 日
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 件のコメント表示非表示 なし
Sergio Alejandro Calderon Villanueva 2021 年 2 月 27 日
Tnak you for you answer deepak

サインインしてコメントする。

### カテゴリ

Find more on Cell Arrays in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by