Delete rows in cell aray where there is anything in one collum.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Karel Starý
le 2 Août 2021
Commenté : Peter Perkins
le 6 Août 2021
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/700847/image.png)
Thanks!
2 commentaires
dpb
le 2 Août 2021
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...
Réponse acceptée
Peter Perkins
le 3 Août 2021
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!