Skip to content

Trouble selecting data #4

@alapo

Description

@alapo

I am attempting to replicate the analyses used in the paper. I have created a reproducible example below where 3 EEG files of 180 seconds are created. The data has 3 epochs of 60 seconds.

  1. Pre-oxy
  2. Surgery-S1
  3. PACU

I continue to get the following error img

I have also attempted to run each epoch individually (so there are no events) and I get the same error.

Below is my code
required files (events and channels).zip

%% Create fake data and save it as a *.mat file
load('C:\Program Files\MATLAB\R2019b\toolbox\nnet\nndemos\private\eegdata.mat')
x = eegdata;
clear eegdata
data = [repmat(x,16,112)];
data = data(:, 1:45000);

EEGdir = 'C:\Users\Gertrude\Desktop\Microstates\raw\Merged\GitHub\';

% Create 3 identical copies which I will import into eeglab with event
% information
save(strcat(EEGdir, 'S01.mat'), 'data');
save(strcat(EEGdir, 'S02.mat'), 'data')
save(strcat(EEGdir, 'S03.mat'), 'data')

%% 3.3.1 Loading datasets in EEGLAB

EEGdir = 'C:\Users\Gertrude\Desktop\Microstates\raw\Merged\GitHub\';
EEGFiles = dir([EEGdir '*.mat']);

for i = 1:length(EEGFiles)
    
    EEG = pop_importdata('dataformat','matlab','nbchan',0,'data',strcat(EEGdir,'\', EEGFiles(i).name),...
        'setname', strcat(EEGFiles(i).name(1:3), '-merged'),'srate',250,'subject', EEGFiles(i).name(1:3),'pnts',0,'xmin',0,...
        'chanlocs','C:\\Users\\Gertrude\\Desktop\\Microstates\\raw\\Merged\\GitHub\\chanlocs.ced');
    
    EEG = pop_importevent( EEG, 'event','G:\\My Drive\\Projects\\Anesthesiology\\Surgical EEGs\\Microstates\\raw\\events.txt','fields',{'latency' 'type' 'position'},'skipline',1,'timeunit',1);
    EEG = pop_reref( EEG, []); % take the average reference
    % save new .set
    EEG = pop_saveset( EEG, 'filename',strcat(EEGFiles(i).name(1:3) ,'-Interp.set'),'filepath','C:\\Users\\Gertrude\\Desktop\\Microstates\\raw\\Merged\\GitHub\\');
    [ALLEEG, EEG, CURRENTSET] = eeg_store( ALLEEG, EEG, 0 ); % store it
end
    eeglab redraw % updates EEGLAB GUI

[ALLEEG EEG CURRENTSET ALLCOM] = eeglab;
STUDY = []; CURRENTSTUDY = 0; ALLEEG = []; EEG=[]; CURRENTSET=[]; % clear eeglab

%% 3.3.2 Select data for microstate analysis
[EEG, ALLEEG] = pop_micro_selectdata( EEG, ALLEEG, 'datatype', 'spontaneous',...
'avgref', 1, ...
'normalise', 0, ...
'MinPeakDist', 10, ...
'Npeaks', 1000, ...
'GFPthresh', 1, ...
'dataset_idx', 1:3 );

% causes error seen here -->  https://i.imgur.com/DaPoBNu.png

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions