Compare .txt to a string.
Mostrar comentarios más antiguos
How can you compare each line of a .txt file to a string?
Respuesta aceptada
Más respuestas (1)
Guillaume
el 23 de Feb. de 2015
filelines = strsplit(fileread('sometextfile'), '\n');
issamestring = strcmp(filelines, 'stringtomatch')
2 comentarios
per isakson
el 23 de Feb. de 2015
Use strtrim to avoid trailing space of the text file.
Guillaume
el 23 de Feb. de 2015
That's assuming you don't want to compare the spaces.
Categorías
Más información sobre String Parsing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!