I used fread function read binary data file but returned all zero after 999 column, how to solve this problem?

조회 수: 5 (최근 30일)
I had a binary data file and i used fread function to read it. The frame_length was 12000. The result of the part less than 998 can be normally displayed, but the columns larger than 999 were incorrectly displayed as 0. And the error message at the bild1024 row showed that the size of left part is 1024*1, right part is 0*0. What is wrong with this and how can I solve this problem? Please help me!
bild1024=zeros(1024,frame_length);
fid=fopen(fullname_get,'rb');
for i=1:frame_length
time_stamp=fread(fid, [1 2],'float32'); %read time stamp
dummy=fread(fid, [1],'float32'); %read dummy
time=fread(fid,[12000,1],'float32');
bild1024(:,i)=fread(fid, [1 1024],'float32');%read pixel values for each frame
int_value=fread(fid, [1 2],'int32'); %read MinMax, Event Marker,
EventText=fread(fid,[1 30],'int8'); % event marker
int_Time=fread(fid, [1 ],'int32'); %Timing Error
Medibus=fread(fid, [1 52],'float32'); % data from medibus
end
  댓글 수: 1
Jan
Jan 2022년 10월 29일
편집: Jan 2022년 10월 29일
Please post a copy of the error message instead of paraphrasing it.
What do you call "The result of the part less than 998"? How can you "normally display" it, if the code stops with an error?
"the columns larger than 999 were incorrectly displayed as 0" - of which variable?
Does "right part is 0*0" mean, that fread(fid, [1 1024],'float32') does not reply a value?
Do you really have 12'000 time values for 1024 pixel values in each frame?
You are overwriting all variables but build1024. Is this intented?
It might be useful, if you mention, which binary format you want to import.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by