matlab cell convert to columns

1.1k Views Asked by At

I am having difficulty with MATLAB. I have 106 columns and 1 row. Each cell in each row contains a different amount of numbers. If I type result{1} I get 7. If I type result{2}, I get 3 numbers, etc... How can I list all the numbers out in the column instead of having individual cells. I know I need to make a zeros matrix but I am not sure about the syntax.

2

There are 2 best solutions below

1
On

Maybe you could 1) Find the maximal number of numbers. 2) Append the missing number of numbers (zeros) to each cell. 3) Use cell2mat.

This may be wasteful, of course, if there are lots of zeros.

0
On

If I understand your question correctly:

>> myCell = {1,[2 3 4],[10 11]}; %// for example
>> [myCell{:}]
ans =
     1     2     3     4    10    11