How to control reading text character by character
8 次查看(过去 30 天)
显示 更早的评论
Hello Everyone. Can please anyone help me about this? I have a text file here that I've already identified which is 'letterabc.txt' and matlab was able to read it and converted it to binary. The said text file has only "ABC" characters inside. What I want to do is to be able to read the characters letter by letter (A->B->C) in a controlled manner. Like its up to the user when will he or she decides to read the next letter(if button is pressed, the user will be able to read the next letter). The characters are already converted to binary (7bits) so I want to be able to read/display (1000001->1000010->1000011) in a controlled manner.

采纳的回答
ES
2017-8-2
fid = fopen('letterabc.txt');
tline = fgetl(fid);
while ischar(tline)
YesOrNo = input('continue Reading [y/n]')
if strcmpi(YesOrNo, 'y')
disp(tline)
tline = fgetl(fid);
else
fclose(fid);
return;
end
end
fclose(fid);
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!