Delete rows in cell aray where there is anything in one collum.
1 回表示 (過去 30 日間)
古いコメントを表示
I have multiple cell arrays and I would like to delete whole rows based on one particular column, if there is anything (text or number) in this column.
Thanks!
2 件のコメント
dpb
2021 年 8 月 2 日
Make it easier -- attach the sample array as .mat file and tell us which column...I presume the selected one, but yoou don't say so...
採用された回答
Peter Perkins
2021 年 8 月 3 日
A cell array is the wrong way to store these data. You want a table, or probably a timetable. The fact that you say, "the name of the variable is EventLTEEvents" makes me wonder if you already have that. And I recommend that you store text in those tables as string, not as cell arrays of char rows.
Once you have that, deleting rows based on a condition is just subscripting, e.g.
T(T.X > 10,:) = []
In your case, the condition is probably something like strlength(T.EventLTEEvents) > 0.
4 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Environment and Settings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!