You have completed the serial communication part correctly. In the AT command set, to check the operation of the device, it is enough if you send "AT" and the line. Also, you simultaneously submitted both a carriage return and a line. This can create a problem. Also, while writing MATLAB code for the first time, try sending characters individually, as in Hyperterminal. This will solve your problem.
There will be no problems from the point of view of MATLAB when the connection is created successfully.
source share