Write command to serial port and read response
writes the ASCII text
response = writeread(
command followed by the terminator to the specified
serial port device, then reads the ASCII text returned from the device and assigns it to
response. You can use this function to query an instrument connected to
the serial port. The function blocks MATLAB and waits until the
response are complete, or a timeout occurs.
Query Serial Device for ID
Write an instrument identification query to a serial instrument and
read the response.
writeline automatically includes the defined
s = serialport("COM3",9600); configureTerminator(s,"CR") ⋮ resp = writeread(s,"*IDN?");
device — Serial port
Serial port, specified as a
command — ASCII text command to device
string | char
ASCII text command to device, specified as a string or character vector.
response — ASCII text response from device
ASCII text response from device, returned as a string. The terminator is not included.