Importing DAT file MATLAB
13 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi guys,
I'm trying to open a DAT file and I came across a rather useful snippet of code as shown below;
[filename, pathname] = uigetfile('*.dat', 'Open file .dat');% only image Bitmap
if isequal(filename, 0) || isequal(pathname, 0)
disp('File input canceled.');
ECG_Data = [];
else
fid=fopen(filename,'r');
end;
time=10;
f=fread(fid,2*360*time,'ubit12');
Orig_Sig=f(1:2:length(f));
plot(Orig_Sig)
The resulting plot looks as though the code has combined and meshed a number of columns together etc. Can anyone advise how I can import bits directly from the columns in the DAT file or best yet open the DAT file in MATLAB?
0 Kommentare
Antworten (1)
Walter Roberson
am 9 Nov. 2020
The .dat file extension is used by many different programs to store data in incompatible formats. You would need to know which program produced the file and have documentation about the file format.
It would be quite unusual for data to be in packed 12 bit values. Not impossible but rarely done. It is a lot more common for 12 bit data to be stored inside 16 bit words, more typically the 12 most significant bits, but sometimes the 12 least significant bits. (You also have to worry about the bit order for packed bits.)
You talk about having meshed a number of columns together, but the way you read the data is only suitable for vector data, for which there would not be any "columns".
2 Kommentare
Walter Roberson
am 9 Nov. 2020
Not much we as volunteers can do without documentation of the file format.
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!