MATLAB Function Reference
  Go to function:
    Search    Help Desk 
fgets    See Also

Return the next line of a file as a string with line terminators

Syntax

Description

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 terminators associated with the text line. To obtain the string without the line terminators, use fgetl.

line = fgets(fid,nchar) returns at most nchar characters of the next line. No additional characters are read after the line terminators or an end-of-file.

See Also

fgetl



[ Previous | Help Desk | Next ]