Effacer les filtres
Effacer les filtres

Keep Only Cells With a String Beginning with a Certain Letter

13 vues (au cours des 30 derniers jours)
Calum
Calum le 24 Oct 2014
Modifié(e) : Adam le 24 Oct 2014
If I have a data-set as follows:
['ABC'; 'ABC'; 'ABC'; 'DEF'; 'DEF'; 'DEF'; 'XYZ'; 'XYZ'; 'XYZ']
How do I only keep rows which contain a string beginning with the letter 'D'?
Regards,
CS

Réponses (1)

Adam
Adam le 24 Oct 2014
Modifié(e) : Adam le 24 Oct 2014
s = ['ABC'; 'ABC'; 'ABC'; 'DEF'; 'DEF'; 'DEF'; 'XYZ'; 'XYZ'; 'XYZ'];
s = s( s(:,1) == 'D',: );
assuming you stated the full complexity of the problem in your question.

Catégories

En savoir plus sur Data Types 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!

Translated by