Hi Didier,

I had a thorough look into your problem.

It occurs because the conditions you impose on  trial selection, 0B_face_target , result in a small number of trials. For the subject  102816 in Run1 there were 8 clean trials in this conditions but the participant response was wrong in all of them. So no trials were selected for this condition 1 in Run1. For Condition 2  some trials were selected. In Run 2 some trials were found for borh conditions 1 and 2.

What then happened was that the hcp_eravg pipeline does not find any data for Condition1-Run1 so it uses only Condition1-Run2 which has 245 clean channels. But for Condition 2 it finds data both from Run1 and Run2 , and although they have both 245 clean channels , they have only 244 common clean channels. Because this fusion of sensors was not done for Condition 1 (as only data from Run 2 was found) there is a mismatch of channels. During the testin we had not use conditions with small number of trials that is why this scenario has escaped our attention.

Now I think the quickest and easiest way to proceed with your work would be to go to function

hcp_eravg_contrasts.m

and in line 292 where you see the code:

        %--------
        if isempty(datacntr2)
errorFname=['NOTRIALSFOUND_',experimentid,'_',scanmnem,'_',sortcontrlist{1}{iC}.mnemprint,'_[MODE-',avgmode,'].txt'];
            errorTime=clock;
errorCase=[experimentid,'_',scanmnem,'_',sortcontrlist{1}{iC}.mnemprint,'_[MODE-',avgmode,']'];
            errorType=['No trials were found for condition 2'];
hcp_write_ascii(errorFname,'errorTime','errorCase','errorType');
            warning(['No trial found for condition 2 in ',experimentid,'  - ',sortcontrlist{1}{iC}.mnemprint]) ;
            continue
        end
        %--------


add the "else" statement :

     %--------
        else
[indChA,indChB]=match_str(datacntr1.label,datacntr2.label); datacntr1=ft_selectdata(datacntr1,'channel',indChA); datacntr2=ft_selectdata(datacntr2,'channel',indChB);

        %--------

So that the whole block would be :

       %--------
        if isempty(datacntr2)
errorFname=['NOTRIALSFOUND_',experimentid,'_',scanmnem,'_',sortcontrlist{1}{iC}.mnemprint,'_[MODE-',avgmode,'].txt'];
            errorTime=clock;
errorCase=[experimentid,'_',scanmnem,'_',sortcontrlist{1}{iC}.mnemprint,'_[MODE-',avgmode,']'];
            errorType=['No trials were found for condition 2'];
hcp_write_ascii(errorFname,'errorTime','errorCase','errorType');
            warning(['No trial found for condition 2 in ',experimentid,'  - ',sortcontrlist{1}{iC}.mnemprint]) ;
            continue
        else
[indChA,indChB]=match_str(datacntr1.label,datacntr2.label); datacntr1=ft_selectdata(datacntr1,'channel',indChA); datacntr2=ft_selectdata(datacntr2,'channel',indChB);
        end
        %--------

I have run again the case in which you received the error with this change and it seems to work.


I hope this helped

Best

Giorgos


On 10/12/2017 12:32 PM, Jean-Didier Lemarechal wrote:
Hi,

I encountered an error when computing a contrast (difference between conditions) for subject 102816 (it worked fine, at least without error, for other subjects {'100307'} ;  {'104012'} ; {'105923'} and {'106521'} ;

The error comes from a mismatch in buffer dimensions : ( cf attached picture )

Error using hcp_eravg_contrasts (line 445)
Matrix dimensions must agree.

I guess it comes from bad channels/trials difference between each condition ?

The contrast is '0B_face_target' versus '0B_face_nontarget'

I am using megconnectome-3.0 and I attached the scripts i am using :

Main script is hcp_eravg_myContrasts_Wrkmem.m and I defined the contrasts I use in mycontrast_Wrkmem.m which is an copy of contrast_Wrkmem.m adapted for my needs.

Thanks in advance for your heelp !

JD



_______________________________________________
HCP-Users mailing list
HCP-Users@humanconnectome.org
http://lists.humanconnectome.org/mailman/listinfo/hcp-users


---
This email has been checked for viruses by AVG.
http://www.avg.com


_______________________________________________
HCP-Users mailing list
HCP-Users@humanconnectome.org
http://lists.humanconnectome.org/mailman/listinfo/hcp-users

Reply via email to