How to convert a .mat file to a .set file in MatLab?

58 次查看(过去 30 天)
Hello!
I want to convert .mat file into eeglab readable format .set. Kindly guide me about the conversion method?

采纳的回答

Ir. Ts. Dr. Kah Yung Yap, CEng (UK)
Dear Khan Muhammad Adeel Khan,
It is necessary to input the correct dimensions of the input data (such as number of samples, number of epochs) when you are using the GUI to load a .mat file. EEGLab requires a dataset to be in the format as the following: "Electrodes x Times x Trials". Before importing .mat into EEGLab, you will need to load your data files into MATLAB and use reshape or other function to format it in the correct way. More details and information can be found here:
I hope this information will be useful. Thank you.
  2 个评论
Dibyajyoti
Dibyajyoti 2023-9-2
I am able to load the .mat file from http://bnci-horizon-2020.eu/database/data-sets for the Two class motor imagery (002-2014) .mat file of participant S01T.
I have followed the reshaping method of Brown Amumbwe
But I am facing one small problem:
I have to keep the number of time points to be same across all the trials. Which is not the case for the dataset that I have downloaded.
Two_Class_S01=load('S01T.mat')
Data_Two_Class_S01 = Two_Class_S01.data
X11_Data= Data_Two_Class_S01{1,1}.X
% Accessing total number of trials
trial_11_S0 = Data_Two_Class_S01{1,1}.trial
% Initializing Three Dimensional Data as time points x channels (15 is channels) x number of
% trials (k stands for number of trials)
for k = 1:numel(trial_11_S0)
ThreeDim_Trial(:, :, k) = ones(trial_11_S0(1),15)
end
for k = 1:numel(trial_11_S0)
if k == 1
ThreeDim_Trial(:,:, k) = X11_Data(1:trial_11_S0(1),:);
else
ThreeDim_Trial(:, :, k) = X11_Data(trial_11_S0(k-1)+1: trial_11_S0(k-1)+trial_11_S0(1),:);
end
end
% Reshaping of Three Dimensional Data as channels (15 is channels) x time points x number of
% trials (k stands for number of trials)
perm_data = permute(ThreeDim_Trial,[2 1 3])
size(perm_data)
The only problem is: I have to keep the number of columns (i.e. number of tme points in a trial) to be same in the 2D array across all the k-th trial.

请先登录,再进行评论。

更多回答(2 个)

Ir. Ts. Dr. Kah Yung Yap, CEng (UK)
Hi, you may use the GUI to load the array: File>>Import Data>> Using EEGLab functions and plugins>>from ASCII/float file or Matlab array. You may write the name of the matrix in the workspace and select "Matlab array".
You may also find these answers useful:

Khan Muhammad Adeel Khan
Dear Yung,
It works for the continuous data but problem with the epoch data. My data format is like : No of epoch*Data Points*No of channel and the sampling frequency is 240 Hz.

类别

Help CenterFile Exchange 中查找有关 Historical Contests 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by