I have a long list from testing data. It looks like
pts={{{{},{}, ..., {{t1, a1, b1, c1}}, ..., {}},{{},{}, ..., {{ti, ai, bi, ci}}, ..., {}}, ..., {{},{}, ..., {{tj, aj, bj, cj}}, ..., {}}},{{{},{}, ..., {{tk, ak, bk, ck}}, ..., {}},{{},{}, ..., {{tm, am, bm, cm}}, ..., {}}, ..., {{},{}, ..., {{tn, an, bn, cn}}, ..., {}}}, ..., {{{},{}, ..., {{tp, ap, bp, cp}}, ..., {}}, {{},{}, ..., {{tq, aq, bq, cq}}, ..., {}}, ..., {{},{}, ..., {{tl, al, bl, cl}}, ..., {}}}}`
in which all {}
are empty lists, generated by Nothing
, and the sub-lists like {t, a, b, c}
include numerical values t
, a
, b
and c
. I have to remove all empty elements and keep those sub-lists with numerical values in the form of
ptsnew={{t1, a1, b1, c1}, {ti, ai, bi, ci}, {tj, aj, bj, cj}, {tk, ak, bk, ck},{tm, am, bm, cm}, {tn, an, bn, cn}, {tp, ap, bp, cp}, {tq, aq, bq, cq}, {tl, al, bl, cl}}`
I have tried DeleteCases[pts, {}, 3]
, which however only removes the empty list on level-3.