MATLAB: How to open a binary .dat file using matlab

.dat binary

Hello everyone,
I am using a handheld radio-frequency spectrum analyzer to save a trace of spectrum. The problem is that the files I saved have a .dat format and really do not know how to read it in matlab. I tried openning it using a conventional text reader like word, notepad and wordpad but I saw only symbols in the file. . I tried:
fid = fopen('C:file.dat','r');
B = textscan(fid, '%f', 'HeaderLines',2);
B = B{1};
fclose(fid);
. but My answer for B is empty. I do not know what to do anymore, can you help me guyz?

Best Answer

Use fread to read binary files