Why does FREAD read my data incorrectly when using the 'char' format specification with MATLAB 7.3 (R2006b) on Linux?

3 visualizaciones (últimos 30 días)
When I use the following command on Windows with MATLAB 7.3 (R2006b):
a=fread(fopen('test'),64,'char')';
size(a)
I obtain
ans =
1 64
On Linux I obtain:
ans =
1 62
'schar' and 'uchar' format specification give me the same answer with FREAD on every platforms.

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 19 de En. de 2010
'char' to FREAD means "read a character in the local codepage". The local codepage is different on Windows and Linux, so that is why there are different results between OSes. To read unsigned bytes and not characters, the correct precision specification is 'uint8' (which is the same as 'uchar').

Más respuestas (0)

Productos


Versión

R2006b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by