필터 지우기
필터 지우기

Skipping first bytes in a binary file using FREAD

조회 수: 7 (최근 30일)
Joshua
Joshua 2011년 5월 2일
I need to skip the first four bytes of a binary file using FREAD, but have not come up with a means to do so. Does anyone have any suggestions? Thanks, Josh

답변 (2개)

Walter Roberson
Walter Roberson 2011년 5월 2일
fread(fid,4,'*uint8');
and don't do anything with the result.
  댓글 수: 1
Jan
Jan 2011년 5월 3일
+1: FREAD has two advantages compared to FSEEK: 1. to my surprise it is faster, 2. it is *never* stopped by the OS, while FSEEK can be breaked in a multi-threaded environment in case of heavy system load. Both effects appear at least in Matlab 6.5 to 2009a and do *not* matter if you skip just 4 bytes. But if you skip some MB, be sure to catch the reply of FSEEK to check for an incomplete processing! While the underlying fseek of the runtime-libs reply the number of moved bytes, such that the processed can be finished iteratively even for relative movement, Matlab's FSEEK replies a flag only.

댓글을 달려면 로그인하십시오.


Sean de Wolski
Sean de Wolski 2011년 5월 2일

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by