As discussed in the comments, the 'problem' seemed to be Matlab adding a 'New Line' which is a decimal 10 in ASCII. Asciitable.com Decimal 10 is the ASCII code for a 'New Line' so it appears your Matlab send code will add a 'New-line' after each sent value. – Paul Apr 14 at 8:15 thank you very match the problem is solved – abbas hussien 5 hours ago You might want to accept this answer so that this question gets 'closed' and the site's statistics will be more accurate. It will also avoid this question being bumped up by the system and people reading into something that has already been solved.
. Find your serial ports — Display a list of serial ports on your system using the seriallist function. Create a serial port object — Create a serial port object for a specific serial port using the creation function. Configure properties during object creation if necessary.
In particular, you might want to configure properties associated with serial port communications such as the baud rate, the number of data bits, and so on. Connect to the device — Connect the serial port object to the device using the function. After the object is connected, alter the necessary device settings by configuring property values, read data, and write data. Configure properties — To establish the desired serial port object behavior, assign values to properties using the function or dot notation. In practice, you can configure many of the properties at any time including during, or just after, object creation.
Conversely, depending on your device settings and the requirements of your serial port application, you might be able to accept the default property values and skip this step. Write and read data — Write data to the device using the or function, and read data from the device using the, or function. The serial port object behaves according to the previously configured or default property values. Disconnect and clean up — When you no longer need the serial port object, disconnect it from the device using the function, remove it from memory using the function, and remove it from the MATLAB ® workspace using the command.
The serial port session is reinforced in many of the serial port documentation examples. To see a basic example that uses the steps shown above, see. Configuring and Returning Properties This example describes how you display serial port property names and property values, and how you assign values to properties. You establish the desired serial port object behavior by configuring property values. You can display or configure property values using the function, the function, or dot notation. Displaying Property Names and Property Values After you create the serial port object, use the function to display all the configurable properties to the command line. Additionally, if a property has a finite set of string values, set also displays these values.
Set(s,'DataBits',7,'Name','Test1-serial') Note that you can configure only one property value at a time using the dot notation. In practice, you can configure many of the properties at any time while the serial port object exists — including during object creation. However, some properties are not configurable while the object is connected to the device or when recording information to disk. For information about when a property is configurable, see.
Specifying Property Names Serial port property names are presented using mixed case. While this makes property names easier to read, use any case you want when specifying property names. For example, to configure the BaudRate property.