In the serial com port channel values comes from 0 to 1023, this example from Arduino: https://monosnap.com/file/TiTehc6zWhu0zszPnCALbnjIMAfpzf
On the MATLAB side I parse it via function:
function sPs = GetsP()
sPs = 0;
Psvoltage = fscanf(obj1);
sPs = str2num(Psvoltage) * (100 / 1023);
But I dont like this variant, because str2num() conversion is very slow. If I try to use Psvoltage = fread(obj1, 1, 'ushort'); I didnt see correct data, because fread() reads binary data.
So the question is: How can I try to read direct number data, without any slow string to number conversion? How can I need to use fread() to get numbers?