Compare .txt to a string.
Mostra commenti meno recenti
How can you compare each line of a .txt file to a string?
Risposta accettata
Più risposte (1)
Guillaume
il 23 Feb 2015
filelines = strsplit(fileread('sometextfile'), '\n');
issamestring = strcmp(filelines, 'stringtomatch')
2 Commenti
per isakson
il 23 Feb 2015
Use strtrim to avoid trailing space of the text file.
Guillaume
il 23 Feb 2015
That's assuming you don't want to compare the spaces.
Categorie
Scopri di più su String Parsing in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!