Concatenate Matlab dataset files
1 view (last 30 days)
Show older comments
Hi Folks,
I am doing some EEG analysis and have several files to merge them, I have to only use row 126 in each file. my files have 257 rows and 117917 columns. I have tried below and failed, saying Index exceeds matrix dimensions.
%A=fullfile('E:\PhD_Master_Dessertation+Scholarships\PhD_Tor Vergata\Study materials\PhD Work\Resources\SSVEP_Based_BCI\Codes\Extraction\FFT\MAMEM EEG SSVEP Dataset I\S001a.mat');
%B=fullfile('E:\PhD_Master_Dessertation+Scholarships\PhD_Tor Vergata\Study materials\PhD Work\Resources\SSVEP_Based_BCI\Codes\Extraction\FFT\MAMEM EEG SSVEP Dataset I\S001b.mat');
X1=importdata('E:\PhD_Master_Dessertation+Scholarships\PhD_Tor Vergata\Study materials\PhD Work\Resources\SSVEP_Based_BCI\Codes\Extraction\FFT\MAMEM EEG SSVEP Dataset I\S001a.mat'); % read first file
X2=importdata('E:\PhD_Master_Dessertation+Scholarships\PhD_Tor Vergata\Study materials\PhD Work\Resources\SSVEP_Based_BCI\Codes\Extraction\FFT\MAMEM EEG SSVEP Dataset I\S001b.mat'); % and second
%dat=interp1(X1(126,:),X2(126,:)); % interpolate 2nd to match first time data
dat=[X1(126,:) X2(126,:)];
%dataset3 = concat(dataset1,dataset2);
% C = sortrows(unique([A(126,:);B(126,:)],'rows'));
% C = [C,nan(size(C))];
% C(ismember(C(126,:),A(126,:),'rows')) = A(126,:);
% C(ismember(C(126,:),B(126,:),'rows')) = B(126,:);
2 Comments
Answers (1)
Walter Roberson
on 16 Jul 2020
X1 = load('E:\PhD_Master_Dessertation+Scholarships\PhD_Tor Vergata\Study materials\PhD Work\Resources\SSVEP_Based_BCI\Codes\Extraction\FFT\MAMEM EEG SSVEP Dataset I\S001a.mat'); % read first file
X2 = load('E:\PhD_Master_Dessertation+Scholarships\PhD_Tor Vergata\Study materials\PhD Work\Resources\SSVEP_Based_BCI\Codes\Extraction\FFT\MAMEM EEG SSVEP Dataset I\S001b.mat'); % and second
dat1 = X1.eeg(126,:);
dat2 = X2.eeg(126,:);
At the moment it does not make sense to interp1() between the two of them. They both have the same sampling rate, so they have the same implied time for the first 117917 columns, and the second one simply ran for 0.352 seconds more.
0 Comments
See Also
Categories
Find more on EEG/MEG/ECoG 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!