Read line of text from instrument and discard terminator
tline = fgetl(obj)
[tline,count] = fgetl(obj)
[tline,count,msg] = fgetl(obj)
[tline,count,msg,datagramaddress,datagramport] = fgetl(obj)
An interface object.
The text read from the instrument, excluding the terminator.
The number of values read, including the terminator.
A message indicating if the read operation was unsuccessful.
The datagram address.
The datagram port.
tline = fgetl(obj) reads
one line of text from the instrument connected to
and returns the data to
tline. The returned data
does not include the terminator with the text line. To include the
[tline,count] = fgetl(obj) returns
the number of values read to
[tline,count,msg] = fgetl(obj) returns
a warning message to
msg if the read operation
= fgetl(obj) returns the remote address and port from which
the datagram originated. These values are returned only if
a UDP object.
Create the GPIB object
a Tektronix® TDS 210 oscilloscope, configure
complete read operations when the End-Of-String character is read,
and write the
*IDN? command with the
the scope to return identification information.
g = gpib('ni',0,1); fopen(g) g.EOSMode = 'read'; fprintf(g,'*IDN?')
Asynchronously read the identification information from the instrument.
readasync(g) g.BytesAvailable ans = 56
fgetl to transfer the data from the input
buffer to the MATLAB® workspace, and discard the terminator.
idn = fgetl(g) idn = TEKTRONIX,TDS 210,0,CF:91.1CT FV:v1.16 TDS2CM:CMV:v1.04 length(idn) ans = 55
g from the scope, and remove
memory and the workspace.
fclose(g) delete(g) clear g
Before you can read text from the instrument, it must be connected
obj with the
A connected interface object has a
open. An error is returned if you attempt
to perform a read operation while
obj is not connected
to the instrument.
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 Window until
The terminator is read. For serial port, TCPIP, UDP,
and VISA-serial objects, the terminator is given by the
Note that for UDP objects,
For all other interface objects except VISA-RSIB, the terminator
is given by the
The EOI line is asserted (GPIB and VXI instruments only).
A datagram has been received (UDP objects only if
The time specified by the
The input buffer is filled.
EOSCharCode property value is recognized
only when the
EOSMode property is configured
EOSMode is configured to
LF, then one of the ways that the
read operation terminates is when the line feed character is received.
then there is no terminator defined for read operations. In this case,
complete execution and return control to the command line when another
criterion, such as a timeout, is met.