Why does FREAD read my data incorrectly when using the 'char' format specification with MATLAB 7.3 (R2006b) on Linux?
3 ビュー (過去 30 日間)
古いコメントを表示
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.
採用された回答
MathWorks Support Team
2010 年 1 月 19 日
'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').
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Web Services についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!