How can I convert an .xlsx (Microsoft Excel97-2003 Worksheet) into a EDF2 File?

4 vues (au cours des 30 derniers jours)
Smaragda Zygridou
Smaragda Zygridou le 7 Août 2019
Réponse apportée : Rahul le 11 Fév 2025
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.

Réponses (1)

Rahul
Rahul le 11 Fév 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.

Catégories

En savoir plus sur AI for Signals dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by