I have to concatenate 6 .mat eeg files

2 visualizaciones (últimos 30 días)
Harshini Gangapuram
Harshini Gangapuram el 24 de Mzo. de 2019
Comentada: Harshini Gangapuram el 24 de Mzo. de 2019
I have to concatenate six .mat files that contains EEG data. The data has 8 channels and different samples.
I want to concatenate the data column wise so that there are 8 rows for channels and the samples keep on adding column wise.

Respuesta aceptada

Walter Roberson
Walter Roberson el 24 de Mzo. de 2019
filenames = {'first.mat', 'second.mat', 'third.mat', 'fourth.mat', 'fifth.mat', 'sixth.mat'};
nfiles = length(filenames);
data_cell = cell(nfiles,1);
for K = 1 : nfiles
data_struct = load(filenames{K});
%we do not know the names of the variable the data is stored in.
%assume it is the first variable in the file.
fn = fieldnames(data_struct);
this_data = data_struct.(fn{1});
data_cell{K} = this_data;
end
%now put it all together into one matrix
data = vertcat(data_cell{:}) .';
  5 comentarios
Walter Roberson
Walter Roberson el 24 de Mzo. de 2019
save('Concatenate.mat', 'data')
or
save Concatenate.mat data
Harshini Gangapuram
Harshini Gangapuram el 24 de Mzo. de 2019
Got it. Thank you!!!!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Biomedical Signal Processing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by