Compare .txt to a string.
이전 댓글 표시
How can you compare each line of a .txt file to a string?
채택된 답변
추가 답변 (1개)
Guillaume
2015년 2월 23일
filelines = strsplit(fileread('sometextfile'), '\n');
issamestring = strcmp(filelines, 'stringtomatch')
댓글 수: 2
per isakson
2015년 2월 23일
Use strtrim to avoid trailing space of the text file.
Guillaume
2015년 2월 23일
That's assuming you don't want to compare the spaces.
카테고리
도움말 센터 및 File Exchange에서 String Parsing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!