Place all elements of a numeric array into separate cells.

a =
8 1 6
3 5 7
4 9 2
c =
[8] [1] [6]
[3] [5] [7]
[4] [9] [2]

Place individual letters of a word into separate cells of an array.

a =
four
five
nine
c =
'f' 'o' 'u' 'r'
'f' 'i' 'v' 'e'
'n' 'i' 'n' 'e'

Generate a 4-by-3-by-2 numeric array, and then create a 1-by-3-by-2 cell array of 4-by-1 column vectors.

A(:,:,1) =
1 5 9
2 6 10
3 7 11
4 8 12
A(:,:,2) =
10 50 90
20 60 100
30 70 110
40 80 120
C(:,:,1) =
[4x1 double] [4x1 double] [4x1 double]
C(:,:,2) =
[4x1 double] [4x1 double] [4x1 double]

Each 4-by-1 vector contains elements from along the *first* dimension of `A`

:

Create a 4-by-1-by-2 cell array of 1-by-3 numeric arrays.

C(:,:,1) =
[1x3 double]
[1x3 double]
[1x3 double]
[1x3 double]
C(:,:,2) =
[1x3 double]
[1x3 double]
[1x3 double]
[1x3 double]

Each 1-by-3 row vector contains elements from along the *second* dimension of `A`

:

Finally, create a 4-by-3 cell array of 1-by-1-by-2 numeric arrays.

C =
[1x1x2 double] [1x1x2 double] [1x1x2 double]
[1x1x2 double] [1x1x2 double] [1x1x2 double]
[1x1x2 double] [1x1x2 double] [1x1x2 double]
[1x1x2 double] [1x1x2 double] [1x1x2 double]

Each 1-by-1-by-2 vector contains elements from along the *third* dimension of `A`

:

ans(:,:,1) =
1
ans(:,:,2) =
10

Create a cell array by combining elements into numeric arrays along several dimensions.

A(:,:,1) =
1 5 9
2 6 10
3 7 11
4 8 12
A(:,:,2) =
10 50 90
20 60 100
30 70 110
40 80 120
c =
[4x1x2 double] [4x1x2 double] [4x1x2 double]

Each 4-by-1-by-2 array contains elements from along the first and third dimension of `A`

:

ans(:,:,1) =
1
2
3
4
ans(:,:,2) =
10
20
30
40

c =
[1x3x2 double]
[1x3x2 double]
[1x3x2 double]
[1x3x2 double]