Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Flattening" a cell array

I have created a function which takes vectors for input variables and returns a cell array for each set of inputs. The final output variable (out) seems to consist of a 2x1 cell containing two 1x5 cells. I have provided a screenshot of this below:

Screenshot of current output

I am just trying to figure out how to flatten the cell array (out) to be a 2x5 cell array.

like image 336
GloveTree Avatar asked Apr 28 '14 07:04

GloveTree


2 Answers

One way to achieve that would be -

vertcat(cell_array1{:})
like image 180
Divakar Avatar answered Nov 13 '22 09:11

Divakar


If your cell has unequal number of elements in each row , maybe this might work better

vector=[cell_array{:}]
like image 39
Rahul Avatar answered Nov 13 '22 08:11

Rahul