cell within a cell

4 Ansichten (letzte 30 Tage)
Fabricio
Fabricio am 16 Mär. 2013
Hello, I have a problem that is taking me some time. I have a 994*15 cell and within those cells there are empty arrays [] and there are arrays of 1*3. It is a bit random. I am trying to get rid of the the empty cells but keep the same cell columns because they are results that will need to be compared afterwards.
Don't hesitate to ask questions. I tried with a loop and the function find, but the results are not working with cells.
  2 Kommentare
Matt J
Matt J am 17 Mär. 2013
Are you sure they are empty "cell arrays'? The symbol [] is an empty numeric array.
Regardless, if you want to maintain the same 994x15 shape, then anything you remove will have to be replaced by something. You have to decide what that will be.
Fabricio
Fabricio am 17 Mär. 2013
Well they are denoted with [], The answer bellow really did the trick!

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Azzi Abdelmalek
Azzi Abdelmalek am 17 Mär. 2013
Bearbeitet: Azzi Abdelmalek am 17 Mär. 2013
A(cellfun(@isempty,A))=[] % A is your cell array
  2 Kommentare
Fabricio
Fabricio am 17 Mär. 2013
Thank you, this seems to work! I appreciate your input.
Jan
Jan am 17 Mär. 2013
As usual I want to stress, that cellfun is faster with the string methods: cellfun('isempty',A).

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Cell Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by