Why does reading and converting UINT64 data fail with FREAD in MATLAB 7.0.1 (R14SP1)?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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.
Respuesta aceptada
MathWorks Support Team
el 27 de Jun. de 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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Convert Image Type en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!