fread + double-precision 8-byte floating point + precision
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Farz Tak
am 29 Okt. 2015
Beantwortet: aijiangzhao aixuwu
am 27 Okt. 2021
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 Kommentare
Akzeptierte Antwort
Geoff Hayes
am 30 Okt. 2015
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 Kommentare
Geoff Hayes
am 30 Okt. 2015
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.
Weitere Antworten (1)
aijiangzhao aixuwu
am 27 Okt. 2021
Hi,I encountered the same problem, did you solve it? Can you tell me?
0 Kommentare
Siehe auch
Kategorien
Mehr zu Database Toolbox finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!