[FieldTrip] Problem with FT's nanmean

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Wed May 6 13:39:40 CEST 2020

Hi Jo,

The size of the variable that you are using as an input is quite large, probably it takes up 20GB of RAM or so.
Perhaps that the low-level c-code, on which the nanmean mex-files are based, has problems dealing with such large variables? Although I would have expected an error to be thrown or a segmentation fault in that case. Does mr. Google provide any directions here (e.g. when searching for the maximum allowed variable size in mex files)?
As a side note, I am surprised that the code defaults to using the mex-file, while you seem to have the legacy nanmean function available.

Best wishes,

On 6 May 2020, at 12:27, joachim.lange at med.uni-duesseldorf.de<mailto:joachim.lange at med.uni-duesseldorf.de> wrote:

Dear all,
I have a dataset with 94 trials, 44800 (virtual) channels, and 600 timepoints. I applied ft_timelockanalysis on this dataset and the output was surprisingly "0" for all channel-time pairs, even for those channels that contained only NaNs (because they were outside the brain). If I tried a smaller number of trials, everything was fine, though (i.e., no zeros, but plausible values).
I was able to boil down the problem to the function "nanmean". If I extract a 94x44800x600 matrix from the dataset and use FT's nanmean (apparently fieldtrip-20200423/external/stats/nanmean.mexa64), the result is zeros, again. If I use matlab's nanmean, everythig seems fine.
Any help is appreciated.
fieldtrip mailing list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20200506/4789ebcb/attachment.htm>

More information about the fieldtrip mailing list