MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1
while ~feof(fid)
line = fgetl(fid);
if isempty(line)
break
elseif ~strncmp(line,'%',1)
continue
end
count = count + 1;
end
fprintf('%d lines in MAGIC help\n',count);
fclose(fid);

TipIf you inadvertently create an infinite loop (a loop that never ends on its own), stop
execution of the loop by pressing Ctrl+C.

See Also
break | continue | end | for | while

2 Program Components

Free download pdf