Asked by Hello kity
on 9 Jan 2013

How can I combine multiple cells in to a single cell

there are 6 cells, each m x n format (n is 17 in all)

I want a new cell created that just adds up below

so for example Cell1 is 50x17 Cell2 is 30x17 Cell3 is 20x17

new cell should then be : AllCell is 100x17

I thought of:

Allcell=cell(Cell1+Cell2+Cell3,17);

but what then

*No products are associated with this question.*

Answer by Thorsten
on 9 Jan 2013

Edited by Thorsten
on 9 Jan 2013

Accepted answer

use the standard concatenation operator [ ]

AllCell = [Cell1; Cell2; Cell3; Cell4; Cell5; Cell6];

Hello kity
on 9 Jan 2013

hmm, i tried this but with , instead of ; inbetween the Cells.

Thank you

Answer by Jan Simon
on 9 Jan 2013

If your cells are **not** called "Cell1", "Cell2", ... but you use an index as index (as suggested repeatedly and consequently in this forum), the concatenation is even easier:

C{1} = rand(50, 17); C{2} = rand(10, 17); C{3} = rand(40, 17); C{4} = rand(30, 17); C{5} = rand(20, 17);

AllC = {cat(1, C{:})};

Show 1 older comment

Image Analyst
on 9 Jan 2013

Opportunities for recent engineering grads.

## 3 Comments

## Hassan F (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/58323#comment_121602

http://www.mathworks.se/help/matlab/matlab_prog/combine-cell-arrays.html

You should find your way from there on, and combine content of cell arrays.

## Jan Simon (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/58323#comment_121603

It slightly confusing: Do you want AllCell to be a scalar cell, which contains a 100x17 matrix?

## Hello kity (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/58323#comment_121621

I found a way but i think it should be easier.

raw is from xlsread, a cell.

between every set of data there is a cell row free.