Use matlab to open .dat file from EEG recording
Show older comments
I have a .DAT file which I want to open in MATLAB (simply changing the file to .txt or trying to open with other programs doesn't work).
I recorded an EEG using 3 recording channels. When I use the following code in an attempt to open it, I get a 60,000 cell, one column output.
>> fid=fopen('Eg1.dat', 'r'); [x,count]=fread(fid, 'float'); fclose(fid);
The EEG channels record the voltage over a period of time. I want to have 4 columns on the output - X being time, Y1,Y2,Y3 being the three channels I recorded with. If anyone has any pointers of where I'm going wrong, I'd be grateful for their help.
Audrey
Answers (1)
Walter Roberson
on 8 Aug 2015
[x,count] = fread(fid, [4 inf], 'float').';
or
[x,count] = fread(fid, 'float');
x = reshape(x, [], 4);
Which of the two to use depends on whether the channels are interweaved or if all of one channel occurs before the next channel (the second case)
Categories
Find more on EEG/MEG/ECoG in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!