fread + double-precision 8-byte floating point + precision
1 次查看(过去 30 天)
显示 更早的评论
Hi All,
I want to use fread to read my binary file. The data type are "double-precision 8-byte floating point". When I put 8*double as precision, it gives me weird values that I am sure it is wrong. How can I put both float + double in precision?
Thanks a lot
0 个评论
采纳的回答
Geoff Hayes
2015-10-30
Farz - if the data type (within your file) is double-precision 8-byte floating point, then why not just use double or float64 as either should correspond to 8-byte floating point numbers? Check out fread input argument precision and use fread as (for example)
A = fread(fileID,[3 3],'double');
3 个评论
Geoff Hayes
2015-10-30
Hi Farz - you should be able to set the machine format when you open the file with fopen. See http://www.mathworks.com/help/matlab/ref/fopen.html#inputarg_machinefmt for details.
更多回答(1 个)
aijiangzhao aixuwu
2021-10-27
Hi,I encountered the same problem, did you solve it? Can you tell me?
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Low-Level File I/O 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!