Read line of ASCII text from device and discard terminator
tline = fgetl(obj)
[tline,count] = fgetl(obj)
[tline,count,msg] = fgetl(obj)
tline = fgetl(obj) reads
one line of ASCII text from the device connected to the serial port
obj, and returns the data to
This returned data does not include the terminator with the text line.
To include the terminator, use
[tline,count] = fgetl(obj) returns
the number of values read to
count, including the
[tline,count,msg] = fgetl(obj) returns
a warning message to
msg if the read operation
On a Windows® platform, create the serial port object
s to a Tektronix® TDS 210 oscilloscope,
and write the
RS232? command with the
the scope to return serial port communications settings.
s = serial('COM1'); fopen(s) fprintf(s,'RS232?')
Because the default value for the
continuous, data is automatically returned to
the input buffer.
ans = 17
fgetl to read the data returned from
the previous write operation, and discard the terminator.
settings = fgetl(s)
settings = 9600;0;0;NONE;LF
ans = 16
s from the scope, and remove
memory and the workspace.
fclose(s) delete(s) clear s
Before you can read text from the device, it must be connected
obj with the
A connected serial port object has a
open. An error is returned if you attempt
to perform a read operation while
obj is not connected
to the device.
msg is not included as an output argument
and the read operation was not successful, then a warning message
is returned to the command line.
ValuesReceived property value is increased
by the number of values read – including the terminator –
fgetl is issued.
A read operation with
fgetl blocks access
to the MATLAB® command line until:
The terminator specified by the
The time specified by the
The input buffer is filled.