Why does reading and converting UINT64 data fail with FREAD in MATLAB 7.0.1 (R14SP1)?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I can read UINT64 data into MATLAB as DOUBLE, but I want to convert it to be UINT64 in the FREAD command by using *. For example, I try the following code:
a=[1 2 3 4];
fid = fopen('test.bin','w');
fwrite(fid,a,'uint64');
fclose(fid);
fid = fopen('test.bin','r');
b = fread(fid,'*uint64');
fclose(fid);
When I run the code, MATLAB returns the following error:
??? Error using ==> fread
Invalid precision.
If I replace UINT64 with UINT32, the code runs without error.
Akzeptierte Antwort
MathWorks Support Team
am 27 Jun. 2009
This bug has been fixed for MATLAB 7.0.4 (R14SP2). For previous releases, please the following:
We have verified that there is a bug in MATLAB 7.0.1 (R14SP1) that affects the way FREAD handles UINT64 data.
To work around this issue, try returning the data as DOUBLE, but cast it to be UINT64. For example, instead of using:
b = fread(fid,'*uint64');
use:
b = uint64(fread(fid,'uint64'));
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Convert Image Type finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!