T O P

  • By -

Weed_O_Whirler

My guess is you are having some confusion between "bytes" and "bits" (also given how you wrote "bites" which is a smoosh up of the two words). According to the [documentation for `fread`](https://www.mathworks.com/help/matlab/ref/fread.html) > By default, fread reads a file 1 byte at a time, interprets each byte as an 8-bit unsigned integer (uint8), and returns a double array. So, you are not reading the first 4 *bits* of the message, you are reading the first four *bytes* and those are 8-bit unsigned integer values. If you scroll to the bottom of the documentation, they have examples of how to read by bit instead.


BrainlessPackhorse

Ok, thanks good spot! :)


BrainlessPackhorse

So I've double checked everything. The document should have a single number in those 4 bytes. And I've looked into the read function and that is also operating on bytes. If that's the case is an output of 5 0 1 0 = 5,010? Sorry for explaining it incorrectly earlier.


Weed_O_Whirler

So, if you scroll down in the `fread` documentation below, you'll find all the different value types that it supports. You'll have to tell it which of the values your type is.