Skip to content

MEF plugin issue: pop_select sorttrials error when trying to select channels #896

Description

@amisepa

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:
Image

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

Activity

  1. arnodelorme commented on Oct 17, 2025

    @arnodelorme
    Collaborator

    Can you post your dataset?

  2. amisepa commented on Oct 18, 2025

    @amisepa
    ContributorAuthor

    @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

  3. arnodelorme commented on Oct 18, 2025

    @arnodelorme
    Collaborator
  4. arnodelorme commented on Feb 13, 2026

    @arnodelorme
    Collaborator

    Issue with MEF plugin. Cedric will fix later when time allows.

  5. 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
  6. amisepa commented on Oct 7, 2026

    @amisepa
    ContributorAuthor

    @arnodelorme following up on this one. It's an easy one I think :)
    The cause is in pop_MEF3.m: the dataset is built from eeg_emptyset, so EEG.trials stays at 0, and eeg_checkset is never called. pop_select then builds its trial list as 1:EEG.trials, which is empty, hence the error.

    In pop_MEF3.m right after the loop that sets EEG.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_select is needed, so the issue can be closed once the release is out.

  7. amisepa commented on Oct 7, 2026

    @amisepa
    ContributorAuthor

    Confirmed. I just tested with MEF3 v1.2.2 on OpenNeuro ds004977 (sub-1, run-02): EEG.trials is 1 after import and pop_select by channel name now runs without error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions