Compare .txt to a string.
Ältere Kommentare anzeigen
How can you compare each line of a .txt file to a string?
Akzeptierte Antwort
Weitere Antworten (1)
Guillaume
am 23 Feb. 2015
filelines = strsplit(fileread('sometextfile'), '\n');
issamestring = strcmp(filelines, 'stringtomatch')
2 Kommentare
per isakson
am 23 Feb. 2015
Use strtrim to avoid trailing space of the text file.
Guillaume
am 23 Feb. 2015
That's assuming you don't want to compare the spaces.
Kategorien
Mehr zu String Parsing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!