MATLAB: How to read data from arduino bluetooth

arduinobluetoothMATLABmatlab programmingsensorsserial

I am successful in sending data from matlab to arduino via Bluetooth, but I am unable to read the data sent by Arduino-bluetooth(JY-MCU).
% serial communication between matlab and bluetooth
delete(instrfind);
b = Bluetooth('BTslave',1);
fopen(b); %write and read function
fwrite(b,'K');
A = fread(b,5)
fclose(b);
clear('b');
I am able to read 5 values but they are just random values not the right values.

Best Answer

Watch out for the default on fread() being 'double' . If the bluetooth device is sending data in some other datatype you need to adjust your fread() to know that.
Related Question