Compare .txt 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 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!