ucdavis/erplab

erp2contraipsi.m does not carry over accepted/rejected/invalid ntrials properly

Opened this issue · 0 comments

Description

The number of accepted/rejected/invalid trials carried over from the old ERP to the new ERP when using erp2contraipsi.m is incorrect.


  1. My ERP has 12 bins and the following number of trials.
ERP.ntrials.accepted = [24 27 41 20 18 34 30 28 34 28 36 30];
ERP.ntrials.rejected = [36 34 24 42 48 30 36 37 29 36 30 35];
ERP.ntrials.invalid = [0 0 0 0 0 0 0 0 0 0 0 0];
  1. I run pop_binoperator() with 'prepareContraIpsi' which will thus call erp2contraipsi.m.
    Original bins 1, 2, 4, 5, 7, 8, 10, 11 are used to compute 8 contra and ipsi new bins.
    Bins 3, 6, 9, 12 are not included in the formula (because they contain relevant stimuli in both hemifield).

  2. Lines 48 - 51 of erp2contraipsi.m transfer ntrials from old ERP to new ERP, but they use the index (1:nbin) instead of passing the list of relevant bins as the index.

  3. Thus, the number of trials is incorrect, because it carried over information from bins 3 and 6 (which are irrelevant for that analysis) and thus also ignored bins 10 and 11 which are relevant.

newERP.ntrials.accepted = [24, 27, 41, 20, 18, 34, 30, 28];
newERP.ntrials.rejected = [36, 34, 24, 42, 48, 30, 36, 37];
newERP.ntrials.invalid = [0, 0, 0, 0, 0, 0, 0, 0];
  1. I believe the fix could be:
    a. Carrying over the list of relevant bins (let's call it relbins)
    b. On line 48, replacing: ERP.ntrials.accepted(1:ERPout.nbin) with ERP.ntrials.accepted(relbins) (same fix for the next 3 lines).

#### Versions
OS version Windows 10 22H2
Matlab version 2024a
EEGLAB version 2024.0
ERPLAB version 12.00