fread function for reading 10 bit raw file.
Mostrar comentarios más antiguos
When I read 10 bit raw file in fread as Uint16 and as uint8 the size of the data is doubled in case of reading as uint8. Wanted to know how fread function internally reads 10 bit data in uint8 and uint16 data type.
sample of my code below:
fid = fopen('2.raw');
data = fread(fid,'uint16');
fclose(fid);
Respuesta aceptada
Más respuestas (1)
Jan
el 10 de Mzo. de 2022
If the 10bit data are written as bitstream, 8 numbers use 10 bytes. If you read this as UINT8 or UINT16 does not matter: the sequence of bits in the memory is equal. If these bits are interpreted as UINT8 or UINT16 will change the values, of course.
A difference is that the number if bytes need not be even, such that reading the file as UINT16 might skip the last byte.
To import the data use the fomat UBIT10:
fid = fopen('2.raw');
data = fread(fid, 'ubit10=>uint16');
fclose(fid);
1 comentario
Gayathri Sankaran
el 11 de Mzo. de 2022
Categorías
Más información sobre Data Import and Analysis en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!