read an empty line in a file

hello everybody, I'm french so escuse me for my english... I've a problem, I have to read a file with matlab and it contains empty line for exemple :
<Node name="root" gravity='0 0 0' dt="0.01"
<EulerImplicitSolver name="cg_odesolver" printLog="0" etc etc
matlab read the first line and stop the reading . I did :
fid = fopen(name,'rt');
tline = fgetl(fid);
while (tline~=-1)
tline = fgetl(fid);
....
....
end
fgetl(fid) returns :
tline =
''
I don't know what I have to do... thnak you very much

 채택된 답변

Friedrich
Friedrich 2011년 8월 10일

0 개 추천

Hi,
try it with feof in the while loop. See here for an example:

추가 답변 (2개)

Fangjun Jiang
Fangjun Jiang 2011년 8월 10일

0 개 추천

use while ~feof(fid) instead
trajik
trajik 2011년 8월 10일

0 개 추천

thank u very much to both of you!!

카테고리

도움말 센터File Exchange에서 Low-Level File I/O에 대해 자세히 알아보기

질문:

2011년 8월 10일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by