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.
sObject=serial('COM4','BaudRate',115200,'TimeOut',10,'Terminator','LF')
Why do i get this NAN,i tried to plot and i get blank screen,why it cant convert my sent data into numbers?
Thanks.
function callbackSerial(ser,~)
global time;
val=fscanf(ser);
numval=str2double(val)
time(16)=numval;
time(1)=[];
disp(time);
figure(1),plot(time);
end
5 Comments
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/629533-matlab-having-problem-interpreting-streamed-string-into-numbers#comment_1095313
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/629533-matlab-having-problem-interpreting-streamed-string-into-numbers#comment_1095313
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/629533-matlab-having-problem-interpreting-streamed-string-into-numbers#comment_1095343
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/629533-matlab-having-problem-interpreting-streamed-string-into-numbers#comment_1095343
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/629533-matlab-having-problem-interpreting-streamed-string-into-numbers#comment_1095658
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/629533-matlab-having-problem-interpreting-streamed-string-into-numbers#comment_1095658
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/629533-matlab-having-problem-interpreting-streamed-string-into-numbers#comment_1096148
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/629533-matlab-having-problem-interpreting-streamed-string-into-numbers#comment_1096148
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/629533-matlab-having-problem-interpreting-streamed-string-into-numbers#comment_1096223
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/629533-matlab-having-problem-interpreting-streamed-string-into-numbers#comment_1096223
Sign in to comment.