MATLAB Functions | Help Desk |
fgets
Return the next line of a file as a string with line terminator(s)
line = fgets(fid) line = fgets(fid,nchar)
line = fgets(fid)
returns the next line for the file with identifier fid
. If fgets
encounters the end of a file, it returns -1
. (See fopen
for a complete description of fid
.)
The returned string line
includes the line terminator(s) associated with the text line (to obtain the string without the line terminator(s), use fgetl
).
line = fgets(fid,nchar)
returns at most nchar
characters of the next line. No additional characters are read after the line terminator(s) or an end-of-file.
fgetl
Return the next line of a file as a string without line
terminator(s)