Compare .txt to a string.
Afficher commentaires plus anciens
How can you compare each line of a .txt file to a string?
Réponse acceptée
Plus de réponses (1)
Guillaume
le 23 Fév 2015
filelines = strsplit(fileread('sometextfile'), '\n');
issamestring = strcmp(filelines, 'stringtomatch')
2 commentaires
per isakson
le 23 Fév 2015
Use strtrim to avoid trailing space of the text file.
Guillaume
le 23 Fév 2015
That's assuming you don't want to compare the spaces.
Catégories
En savoir plus sur String Parsing 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!