Removing certain lines of text from a cell array
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
jgillis16
le 12 Juin 2015
Commenté : Azzi Abdelmalek
le 12 Juin 2015
I have a 53218x1 cell named N1. It is a cell consisting of the names of galaxies I have taken from a loaded ASCII catalog. I need to remove galaxies that have the first three letters starting with 'ESO'. There are 5,980 of these lines of code I have to remove. How would I do that? Would a 'for loop' work?
SIDE NOTE: these words all are 1x10 char in N1.
0 commentaires
Réponse acceptée
Titus Edelhofer
le 12 Juin 2015
Hi,
that should be fairly straight forward:
% find the indices of ESO
idx = strncmp(N1, 'ESO', 3);
% and remove them:
N1(idx) = [];
Titus
0 commentaires
Plus de réponses (1)
Azzi Abdelmalek
le 12 Juin 2015
v={'esoabcd';'abcgd';'ehdf';'esoez'}
out=v(cellfun(@isempty,regexp(v,'(?<=eso).+')))
2 commentaires
Voir également
Catégories
En savoir plus sur Read, Write, and Modify Image 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!