T-test agaist zero in the source space

Hi Brainstorm team,

since I last updated brainstorm, I am having troubles displaying the results of a t-test against zero in the source space (constrained). I did not have the same problem before and I do not have it when I contrast the same source files with others in another condition (paired t-test).

here's the error I get.


Thank you for your help!


Hi Rocco,

I can't see your screen capture.
Can you copy-paste the full error message you get please?

Do you know (approximately) what version was working previously? and when did it stop working?


Hi Fran├žois

here you go, this is the message I get when I try to display the results (no errors during the execution of the test).

Error in fzero.m
Line 327: Operands to the Il and && operators must be convertible to logical scalar values.
Call stack

fzero.m at 327
process_extract_pthresh.m>Compute at 350
process_extract_pthresh.m at 28
bst_memory.m>LoadResultsMatrix at 1163
bst_memory.m at 70
view_surface_data.m at 150
tree_callbacks.m at 283
bst_call.m at 28
panel_protocols.m>CreatePanel/protocolTreeClicked_Callback at 109

I am pretty sure that my previous version was up to date (the last one before this one). The paired ttest works anyway, as well as the nonparametric contrasts between conditions.

Thanks! have a good day


This indeed corresponds to code that was added very recently by @tvincent.

Can you start by checking that you don't have in your Matlab path a toolbox which has a version of fzero.m that shadows the Matlab version? (type "which fzero" in your Matlab command window).

Otherwise: could you please try to package an example with which we can reproduce the error?
(right-click on the subject > File > Duplicate subject, then remove all the unnecessary files for reproducing the error, then right-click on the duplicated subject > File > Export subject, and upload the .zip file somewhere)

It doesn't seem to be a problem with fzero shadowing.

which fzero
C:\Program Files\MATLAB\R2017a\toolbox\matlab\optimfun\fzero.m

Please, find at this link an example source file.

Just because possibly it matters (and because the file might look weird), in order to generate this file I used this procedure:

  • I run (outside brainstorm) several linear models to predict some response based on my EEG data at the scalp level.

  • Thus, I obtained a matrix with the timecourse of beta-values for each electrode (and subject), which I multiplied (always outside brainstorm) with the source Kernel of each subject, obtaining a pixel by time matrix.

  • Then, I created a duplicate of a brainstorm source file, where I pasted the data of the matrix in the field ImageGridAmp, and I emptied the field headModelFile, in order to open the file in brainstorm without errors. So, basically I am using brainstorm to have a nice visualization of source-level data and statistics.


Just a thing to precise: I am running a ttest against zero between participants, so I have 1 file for subject. I upload them all in the folder to allow you to rerun the test. I also upload the ttest file which I cannot visualize.


Hi Rocco,

There were indeed some file configurations (only one time point) that were not compatible with newer developements (adaptive colormaps for t-test from @tvincent). I think I fixed it, please update Brainstorm and try again.

@tvincent: The corrected p-values returned by bst_stat_thresh are not necessarily a simple scalar. When applying a FDR correction independently for each dimension, you might obtain multiple values (or in Rocco's case, when the input file has only one time point, this one is replicated in time). You code was not handling this correctly. I use now the average of all these corrected p-values, I guess that this will work in most cases, but feel free to propose a different approach:


Thanks Fran├žois! Now I manage to visualize the ttest file.