# fgets

## Purpose

Return the next line of a file as a string with newlines.

## Synopsis

    line = fgets(fid)

## Description

`line = fgets(fid)` returns the next line for the file with identifier `fid`. `line` is a MATLAB string that includes the newline character associated with the text line (to obtain the string without the newline, use `fgetl`). If `fgets` encounters an end-of-file indicator, it returns -1.

`fgets` is intended for use with text files only. Given a binary file with no newline characters, `fgets` may require long execution time.

## See Also

    fgetl

(c) Copyright 1994 by The MathWorks, Inc.