fgetlで空行を認識したい
이전 댓글 표시
fgetlで空行を認識したい。
以下のPRGでは、q2.txtをfgetlで読見込みをおこないます。
下記のようにすれば可能ですが、%行でもできると思うのですが、空行を認識しません。
アドバイスをいただけませんか?
%e81.m
fileID = fopen('q2.txt'); % q2' = [1 2 3
while(1)
tline = fgetl(fileID)
if length(tline)==0 fprintf(" blank line\n");
%if tline==[] fprintf(" blank line\n"); % unrecognized, why?
elseif tline<0 fprintf(" file end\n"); break; end
end
fclose(fileID);
%{
%q2.txt
1
2
3
4
5
%}
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Beamforming and Direction of Arrival Estimation에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!