1

I have a cell array BEcell(n,2) which each cell is an n*2 array. I want to convert the first and then the second column of this cell array into a m*2 matrix.

this is my cell array : BEcell =

          []    [2x2 double]
          []    [3x2 double]
          []    [2x2 double]
          []    [2x2 double]
          []    [2x2 double]
          []    [2x2 double]
          []    [2x2 double]
          []    [2x2 double]
          []    [2x2 double]
          []    [2x2 double]
[5x2 double]    [3x2 double]
[2x2 double]    [4x2 double]
          []    [3x2 double]
          []    [2x2 double]
          []    [2x2 double]
          []    [2x2 double]
          []    [2x2 double]
[1x2 double]    [3x2 double]
          []    [2x2 double]

I want to turn this into two different matrices: one 8*2 and the other on 44*2. I tried cell2mat but this error occurs:

>> cell2mat(BEcell)
Error using cat
Dimensions of matrices being concatenated are not consistent.

Error in cell2mat (line 87)
        m = cat(2,m{:});

is there any efficient way to implement this? I also used for loop and deleting empty cells but these seems very complicated and still no result. can you give a clue? a guidance will be great .

parastoo91
  • 151
  • 1
  • 12

0 Answers0