How could I read binary DAT file?

Hi all,
I am trying to open a binary file (16 bit I guessed), which obtained from my DAQ.
However, I only get an empty array and weird number "6". Please find the attachment.
How could correctly read the content?
Thanks in advance!
fileID = fopen('Data_1.dat','r');
A = fread(fileID,Inf,'uint16');
fclose(fileID);

1 comentario

dpb
dpb el 25 de Ag. de 2020
Editada: dpb el 25 de Ag. de 2020
The manufacturer of the DAQ will have documentation on the format of any files their software creates; otherwise need to know what was used to create the file to have any idea on its format...
W/o even the code you used, we're left to guess, but the image looks like all you have done is to open a file and return a file handle; that doesn't read any data at all. It would also appear that with the number 6 you have a bunch of open file handles; the default first unit returned is "3".
Unless you mean to have other files open at the same time, I'd suggest starting over again and begin with
close all
to clean up probably orphaned open file handles.
Read the documentation on fopen, fread and friends and look at the examples to see how actually read binary files...playing with some of those to get the hang of it would never hurt. Then, once you know what the format of your file actually is, you will probably be able to read it successfully.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Etiquetas

Preguntada:

el 25 de Ag. de 2020

Editada:

dpb
el 25 de Ag. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by