How to read 8-byte floating point numbers from binary?use fread
Show older comments
fseek(fid,56,'bof');
x = fread(fid,1,'float64','b')
3 Comments
Cris LaPierre
on 28 Oct 2021
What is or isn't happening? Why do you think this code is incorrect?
aijiangzhao aixuwu
on 29 Oct 2021
Walter Roberson
on 29 Oct 2021
When you fopen you should specify the byte order as the third parameter to fopen, unless you are reading from something with mixed orders.
If you are reading from something with mixed orders but know the order for one particular binary fread then specify the byte order as a parameter to fread.
If you are reading a sequence of bytes at one time and regrouping them (such as if you were reading a structure with mixed datatype) then if necessary use swapbytes after any necessary typecast()
Accepted Answer
More Answers (0)
Categories
Find more on Large Files and Big Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!