Repository navigation
MEF plugin issue: pop_select sorttrials error when trying to select channels #896
Description
Activity
Can you post your dataset?
dataset: https://drive.proton.me/urls/B989CRNFWG#WalrQsBo0xFQ
filepath = '/Users/cedriccannard/Downloads/dataset1';
filename = 'sub-01_ses-ieeg01_task-ccep_run-01_ieeg.mefd';
EEG = pop_MEF3(fullfile(filepath, filename)); % eeglab MEF3 plugin% select some channels
EEG = pop_select( EEG, 'channel', {'ROC1' 'ROC2' 'ROC3' 'ROC4'}); % --> sorttrial error aboveI found the issue: pop_MEF3 defines EEG.trials = 0 during import. I fixed it locally but would need to fix the pop_MEF3 plugin directly and make a new release. There are a few other issues so I'll do that when I address all of them.
Could be good to have a fallback in pop_select though for when EEG.trials is just not defined well (this could probably happen with other importation plugins), check size(EEG.data), and put 1 if continuous or number of events if epoched?
Cedric
- OK, I will have a look…On Oct 18, 2025, at 23:14, Cedric Cannard ***@***.***> wrote: amisepa left a comment (sccn/eeglab#896) @arnodelorme dataset: https://drive.proton.me/urls/B989CRNFWG#WalrQsBo0xFQ filepath = '/Users/cedriccannard/Downloads/dataset1'; filename = 'sub-01_ses-ieeg01_task-ccep_run-01_ieeg.mefd'; EEG = pop_MEF3(fullfile(filepath, filename)); % eeglab MEF3 plugin % select some channels EEG = pop_select( EEG, 'channel', {'ROC1' 'ROC2' 'ROC3' 'ROC4'}); % --> sorttrial error above I found the issue: pop_MEF3 defines EEG.trials = 0 during import. I fixed it locally but would need to fix the pop_MEF3 plugin directly and make a new release. There are a few other issues so I'll do that when I address all of them. Could be good to have a fallback in pop_select though for when EEG.trials is just not defined well (this could probably happen with other importation plugins), check size(EEG.data), and put 1 if continuous or number of events if epoched? Cedric — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: ***@***.***>
Issue with MEF plugin. Cedric will fix later when time allows.
- changed the title
[-]pop_select sorttrials error when trying to select channels[/-][+]MEF plugin issue: pop_select sorttrials error when trying to select channels[/+]on Feb 13, 2026 @arnodelorme following up on this one. It's an easy one I think :)
The cause is inpop_MEF3.m: the dataset is built fromeeg_emptyset, soEEG.trialsstays at 0, andeeg_checksetis never called.pop_selectthen builds its trial list as1:EEG.trials, which is empty, hence the error.In
pop_MEF3.mright after the loop that setsEEG.srate:EEG.trials = 1; EEG.xmin = 0; EEG = eeg_checkset(EEG);This is still the case in MEF3 v1.2.2 and in the current master of arnodelorme/matmef. Could you add it and push a new plugin release (1.2.3)? I can also open a PR on arnodelorme/matmef if you prefer.
With this in the plugin, I do not think a fallback in
pop_selectis needed, so the issue can be closed once the release is out.Confirmed. I just tested with MEF3 v1.2.2 on OpenNeuro ds004977 (sub-1, run-02):
EEG.trialsis 1 after import andpop_selectby channel name now runs without error.
Trying to simply select some EEG channels:
EEG = pop_select( EEG, 'channel',{'ROC1','ROC2','ROC3','ROC4','ROC5','ROC6','ROC7','ROC8','ROC9','ROC10','ROC11','ROC12','ROC13','ROC14','ROC15'});
And for some reason I get this error:

in pop_select, even though g.sort is empty, g.sorttrial is set to on by default. And my data are continuous so I think that triggers the error.
Cedric