How to delete empty rows from string arrays contained in a cell array?
Afficher commentaires plus anciens
I would need to delete empty strings contained in N x 1 string arrays (N is variable) which are contained in a cell array theirself.
mycellArray is a 3×1 cell array and is made up of string arrays of variable dimensions:
- mycellArray{1} is a 49×1 string array
- mycellArray{2} is a 22×1 string array
- mycellArray{3} is a 35×1 string array
mycellArray{1} looks like:

How can I delete just the empty rows "" and let the written text?
Thanks in advance!
Réponse acceptée
Plus de réponses (1)
Arthur Roué
le 10 Juil 2020
% Logical array, true when element in cell is empty
vb = cellfun(@isempty, MyCell)
% Remove empty element
MyCell = MyCell(~vb)
2 commentaires
Davide Festa
le 10 Juil 2020
Arthur Roué
le 10 Juil 2020
Modifié(e) : Arthur Roué
le 10 Juil 2020
Oh, ok I misunderstood the problem.
I think you have your answer below :)
Catégories
En savoir plus sur Characters and Strings dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!