Dear colleagues, I have binary file. But I do not know how to read and convert to .CSV file. Please help. I attached it for reference. Thanks. https://drive.google.com/open?id=0Bx6bUTVOinyySl9nUnN2TGxxc2c

댓글 수: 2

KSSV
KSSV 2017년 3월 3일
You must know the format of binary file to read. Do you know the format? Doc fread
Xuan Hiep Dinh
Xuan Hiep Dinh 2017년 3월 5일
The format of binary file is : (x1.re(short))(x1.im(short))(x2.re(short))(x2.im(short))...

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

 채택된 답변

Jan
Jan 2017년 3월 3일

0 개 추천

There is an infinite number of binary formats. The file extension "bin1" does not reveal, how the data are stored internally. It could be a vector of double values, or perhaps it starts with the dimensions as UINT64 vector and then the values are stored as single. This cannot be predicted and an examination of the data is not reliable also. You have to ask the person, who has written the file, or read the corresponding docs.
If you know the structure of the file, fread allowes to read the parts. Finally csvwrite creates the wanted file.

댓글 수: 1

Xuan Hiep Dinh
Xuan Hiep Dinh 2017년 3월 5일
The format is: (x1.re(short))(x1.im(short))(x2.re(short))(x2.im(short))...

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2017년 3월 3일
편집: Walter Roberson 2017년 3월 3일

0 개 추천

fid = fopen('test2.bin1');
data = fread(fid, '*uint8');
data = reshape(data, 32, []);
imshow(data);
Or possibly
data = reshape(data, 1, []);
imshow(data);

댓글 수: 4

Xuan Hiep Dinh
Xuan Hiep Dinh 2017년 3월 5일
Thanks for comment. Actually, I have 2 steps. First, read the file. And second, do FFT for this.
Xuan Hiep Dinh
Xuan Hiep Dinh 2017년 3월 5일
The format is: (x1.re(short))(x1.im(short))(x2.re(short))(x2.im(short))...
How can I reproduce 4 columns ?
fid = fopen('test2.bin1');
temp = fread(fid, [2 inf], 'uint16=>double');
fclose(fid);
data = complex(temp(1,:), temp(2,:));
Note: all of the complex components are 0.
You appear to have pulses of width 63 or (more often) 64, that are placed 125 or 126 apart. So this is basically a square wave with a duty cycle just slightly greater than 1/2
Xuan Hiep Dinh
Xuan Hiep Dinh 2017년 3월 12일
Thank so much !

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

카테고리

태그

질문:

2017년 3월 3일

댓글:

2017년 3월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by