Read double precision numbers from binary file
Mostrar comentarios más antiguos
Hello,
I have to read double precision numbers from a binary file. I'm used to do that in C, which basically looks like that for a LSB first coded file :
char *cAddress = NULL;
double value = 0;
cAddress = (char*)(value);
*cAddress = ucBuffer[uiOffset];
*(cAddress + 1) = ucBuffer[uiOffset + 1];
*(cAddress + 2) = ucBuffer[uiOffset + 2];
*(cAddress + 3) = ucBuffer[uiOffset + 3];
*(cAddress + 4) = ucBuffer[uiOffset + 4];
*(cAddress + 5) = ucBuffer[uiOffset + 5];
*(cAddress + 6) = ucBuffer[uiOffset + 6];
*(cAddress + 7) = ucBuffer[uiOffset + 7];
Now, I would like to implement that in Matlab. Do you have any idea on how I should proceed ?
Thanks a lot for supporting
Franck
Respuesta aceptada
Más respuestas (1)
doc fread
That help page should give you the information you need on precision and other aspects of binary file reading, together with examples. It should be a lot simpler than the raw C equivalent.
1 comentario
Franck D'Araujo
el 5 de Mzo. de 2015
Categorías
Más información sobre Low-Level File I/O en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!