Delete empty cells in 3 dimensional cell array

2 Ansichten (letzte 30 Tage)
Peter Bu
Peter Bu am 23 Sep. 2018
Bearbeitet: dpb am 23 Sep. 2018
Hello everyone,
I want to delete the empty cells in the cell array of the picture. How do I do it? Thanks in advance!
#Peter

Antworten (1)

dpb
dpb am 23 Sep. 2018
That's a 2D cell array w/ three columns, not a 3D array.
c=c(~cellfun(@isempty,c));
  2 Kommentare
Peter Bu
Peter Bu am 23 Sep. 2018
Thanks. But I want to keep the elements in the right column. When I run your code it is all in one column. How do it do it?
dpb
dpb am 23 Sep. 2018
Bearbeitet: dpb am 23 Sep. 2018
No can do.
Even a cell array itself must be rectangular; it can contain variable-length (including 0) elements in a cell but it, itself as the container is not "jagged".
Nor is there a sparse cell array.
Bestest I see you could do would be to save the one column and a corollary variable of column number.
Or, if it's just the display formatting of the empty brackets, could make that a little less obvious by setting all the empty cells to the empty string instead of empty.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Operators and Elementary Operations 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