This question is closed. Reopen it to edit or answer.

Matlab having problem interpreting streamed string into numbers.

1 view (last 30 days)
fima v
fima v on 28 Oct 2020
Closed: MATLAB Answer Bot on 20 Aug 2021
Hello , i am sending 0x61 over and over which is the letter 'a' to matlab as shown bellow.
But when i want to convert the recieved letters into number and plot it gives me all NAN instead of 61 as shown bellow.
Why do i get this NAN,i tried to plot and i get blank screen,why it cant convert my sent data into numbers?
function callbackSerial(ser,~)
global time;

Answers (1)

Steven Lord
Steven Lord on 29 Oct 2020
Please remove the semicolon from the end of this line, let your callback trigger a few times, and show us exactly what gets displayed in the Command Window.
That information will likely help us determine how to "interpret" the data you're receiving from the serial port.
I suspect what you want is hex2dec not str2double, but the information about what exactly val is will support or refute that suspicion.
  1 Comment
fima v
fima v on 30 Oct 2020
Hello steven, i have written again and added the data you asked in the link shown bellow
could you answer it?

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by