File Exchange

image thumbnail

Matlab to EDF Conversion

version 1.0 (7.29 KB) by

This is a simple GUI to allow easy conversion of MAT files to EDF. It is based on BioSig Toolbox.

14 Downloads

Updated

View License

This is a simple GUI to convert MAT signal file to EDF file. Since I created this program to convert EEG data, therefore when using with your MAT files, please make sure that signal is stored in variable named EEG of dimension: mxn, where m is the data length and n is number of channels and specify the sampling rate. Hit create to do the conversion.

Note: This is an ongoing work and the current version relies on the BioSig toolbox. Make sure you have it installed in your MATLAB.

Enjoy
Rajeev

Comments and Ratings (14)

I insert in the GUI an EEG file that is in the format of a matrix as you described above. Not sure how to add the header file.

Thanks for sharing your code. I tried on one small dataset through running the GUI, but it didn't work! Here is the error message:
Would you be able to help me out? I am happy to share my data , what is your email address?

Neither PhysDim nor PhysDimCode defined in file C:\Users\k1509957\Documents\eeg.edf
Warning SOPEN: HDR.PhysDimCode of the following channel(s) is(are) not defined:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
Undefined function or variable 'swrite'.

Error in EDFCreator>pbCreate_Callback (line 225)
HDR = swrite(HDR,EEG);

Error in gui_mainfcn (line 95)
feval(varargin{:});

Error in EDFCreator (line 45)
gui_mainfcn(gui_State, varargin{:});

Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)EDFCreator('pbCreate_Callback',hObject,eventdata,guidata(hObject))

Error while evaluating UIControl Callback

Rajeev Yadav

The question should be asked clearly. What is the source of your EEG file? Meaning which system was used to acquire the EEG signals. For e.g. Stellate, Neurscan etc etc. This will help us determine what additional tool would be needed to do the conversion. Try exporting your signal to EDF and then access it in MATLAB is easier.

COULD U PLS... help me for converting e .eeg file into csv r matlab loadable format

Rajeev Yadav

Please share a dataset to better understand the cause of error in your data conversion. Remember to have right version of BioSig Toolbox.

Sole

Sole (view profile)

Hi,
thank you for your progam! I tried to run EDFCrator but I recieved this message:

Neither PhysDim nor PhysDimCode defined in file ..../EEG.edf
Warning SOPEN: HDR.PhysDimCode of the following channel(s) is(are) not defined:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62

I don't understand which is the problem: I mean, how can EDFCreator insert channel information in .edf file?

Rajeev Yadav

Also, note that if you are using most recent version of the MATLAB, please open the .m file and execute it instead of opening the GUI. It will work properly.

Anastasia

Thank you very much, I sent you a small dataset on the contact part on matlab. Thank you.

Rajeev Yadav

could share a small dataset you would like to convert to my email ID? I will have a look.

Thanks

Anastasia

Hello,
Thank you very much for your program! I am very very new to matlab. I have a problem and I would appreciate very much if you could help me.

When I try to convert .mat to .edf, i obtain the following errors:

Undefined function or variable "EEG".

Error in EDFCreator>pbCreate_Callback (line 185)
[m, n] = size(EEG);

Error in gui_mainfcn (line 95)
feval(varargin{:});

Error in EDFCreator (line 45)
gui_mainfcn(gui_State, varargin{:});

Error in
@(hObject,eventdata)EDFCreator('pbCreate_Callback',hObject,eventdata,guidata(hObject))

I record my signals in .daq and then I convert it to .mat (before converting .daq to .mat) with the following program:

X=daqread('H:\...');

EEG=[m n];

m=length(X);
n=1;

plot(X);

EEG=X(:,1);
EMG=X(:,2);

save('H:\....mat','X');

You say that we should make sure that the signal is stored in variable named EEG of dimension: mxn, where m is the data length and n is number of channels and specify the sampling rate.

What can I change in my program to make it work? I am sorry to ask you maybe simple question but I am very new to matlab.

Thank you very very much in advance!
Ines

Pavlov

Pavlov (view profile)

Where can I get the swrite function?

Igor Arroyo

I meant the function "fwrite",
Thank you in advance

Igor Arroyo

Hi, thanks for the file but I couldn't use it because of the function write, I can't find it anywhere.
I would be really grateful if you could help me.

Naoji

Naoji (view profile)

I have tried to run your MATLAB to EDF Conversion tool using Matlab 2010b and 2013 versions. However, i have encountered some troubles in the conversion. I kept receiving the following message after each conversion trial:

Neither PhysDim nor PhysDimCode defined in file C:\Users\Lemya\Desktop\EEG Experiment May 2013 csv format\Session 1\1. Wei S1\EEG1.edf
Warning SOPEN: HDR.PhysDimCode of the following channel(s) is(are) not defined:
1 2 3 4 5 6 7 8 9 10 11 12 13 14

I would really appreciate your help

Thank you in advance

MATLAB Release
MATLAB 7.14 (R2012a)
Acknowledgements

Inspired: blockEdfLoad

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today

EDFProject/