How can I convert an .xlsx (Microsoft Excel97-2003 Worksheet) into a EDF2 File?
5 views (last 30 days)
Show older comments
I need to convert a Microsoft Excel 97-2003 Worksheet into a EDF2 File and I was wondering whether anybody has created a code for this task before.
0 Comments
Answers (1)
Rahul
on 11 Feb 2025
In order to convert a Microsoft Excel Worksheet to an EDF file, consider using the functions 'xlsread' or 'readmatrix' or 'readtable' based on how you would want to convert and work with data in MATLAB.
Now, consider using 'edfwrite' function to convert the data obtained from the excel file to EDF file formats.
Note: 'edfwrite' was introduced from MATLAB R2021a.
Here is an example:
% Read the data from the excel file
data = xlsread('yourfile.xlsx');
% Adjust the EDF properties according to personal use-case
hdr = edfheader("EDF+");
hdr.NumDataRecords = 1;
hdr.DataRecordDuration = seconds(length(data(:,1))/fs);
hdr.NumSignals = 8;
hdr.SignalLabels = ["F1" "F2" "F3" "F4" "F5" "F6" "F7" "B1"];
hdr.PhysicalDimensions = repelem("mV",8);
hdr.PhysicalMin = min(data);
hdr.PhysicalMax = max(data);
hdr.DigitalMin = repmat(-32768,1,8);
hdr.DigitalMax = repmat( 32767,1,8);
% Write the EDF file
edfwrite('output.edf', hdr, num);
Consider checking the following MathWorks FileExchange submissions as well:
The following MathWorks documentations can be referred to know more:
Hope this helps! Thanks.
0 Comments
See Also
Categories
Find more on AI for Signals 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!