wilcard usage with strncmp
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
sermet OGUTCU
le 16 Mai 2021
Commenté : sermet OGUTCU
le 16 Mai 2021
I have a cell array data (C). I use the following code to find specific character in the C;
find_character = strncmp(C, '* 2020', 7);
How can I use wilcard using strncmp to find all patterns satisfy * [0-9][0-9][0-9][0-9]? For example, if * 1988 or * 2000 exist in C, they can be also extracted.
0 commentaires
Réponse acceptée
Stephen23
le 16 Mai 2021
C = {'hello','* 2020','world','* 1923'};
X = ~cellfun(@isempty,regexp(C,'^\* \d{4}$'))
D = C(X)
4 commentaires
Plus de réponses (1)
Image Analyst
le 16 Mai 2021
Use the pattern functionality. I think it's easier than regexp().
>> doc pattern
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!