Mensen / ept_TFCE-matlab

Advanced EEG Statistics
27 stars 9 forks source link

TFCE producing no results... Matlab update Mex issue on Windows #20

Open paulsowman opened 6 years ago

paulsowman commented 6 years ago

TFCE_Method.pdf

Mensen commented 6 years ago

Thanks for the comment... I also just recently experienced the same error when working off a windows machine, on Matlab 2017b, with the MinGW compiler. Normally I work on a linux machine, so it was hard for me to track and fix this error... so I'm not sure whether this was the new Matlab, or the new Matlab default compiler, or some combination with windows... But the c-script (mexed into Matlab) that's being called now just returns the default 0 structure for some reason.

Can you confirm what system, matlab version and compiler you're using in Matlab (mex -setup)... if you have the possibility to switch to another compiler, then re-mex the .c files for your particular system this might solve the issue with the TFCE calculation without too much tinkering. The alternative could be to use another system if available to just run the TFCE calculation for now until I can sort out this issue.

Sorry about these things... its one of the drawbacks of using Matlab with an ever-changing set of tools every 6 months to try and keep up-to-date with on several different operating systems.

Let me know!

paulsowman commented 6 years ago

Thanks very much for that reply. I had come to the same conclusion but that’s very helpful as I can start trying some different combos of matlab/mex.

I’m running 2017b on OSX. I compiled the mex using Xcode with Clang.

I’ll let you know if I find a combo that works. Many thanks. P

From: Armand Mensen notifications@github.com Reply-To: Mensen/ept_TFCE-matlab reply@reply.github.com Date: Saturday, 28 April 2018 at 9:02 pm To: Mensen/ept_TFCE-matlab ept_TFCE-matlab@noreply.github.com Cc: Paul Sowman paulsowman@gmail.com, Author author@noreply.github.com Subject: Re: [Mensen/ept_TFCE-matlab] TFCE (#20)

Thanks for the comment... I also just recently experienced the same error when working off a windows machine, on Matlab 2017b, with the MinGW compiler. Normally I work on a linux machine, so it was hard for me to track and fix this error... so I'm not sure whether this was the new Matlab, or the new Matlab default compiler, or some combination with windows... But the c-script (mexed into Matlab) that's being called now just returns the default 0 structure for some reason.

Can you confirm what system, matlab version and compiler you're using in Matlab (mex -setup)... if you have the possibility to switch to another compiler, then re-mex the .c files for your particular system this might solve the issue with the TFCE calculation without too much tinkering. The alternative could be to use another system if available to just run the TFCE calculation for now until I can sort out this issue.

Sorry about these things... its one of the drawbacks of using Matlab with an ever-changing set of tools every 6 months to try and keep up-to-date with on several different operating systems.

Let me know!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

paulsowman commented 6 years ago

So, I’ve looked into trying a different compiler but it seems matlab now only supports clang via xcode on Mac platform now. There are some workarounds for GCC on the net but they look messy. I will try a windows machine when I next have access to one.

Same problem on matlab 2016b which is the oldest version I have access to at present.

Kind regards, P

From: Armand Mensen notifications@github.com Reply-To: Mensen/ept_TFCE-matlab reply@reply.github.com Date: Saturday, 28 April 2018 at 9:02 pm To: Mensen/ept_TFCE-matlab ept_TFCE-matlab@noreply.github.com Cc: Paul Sowman paulsowman@gmail.com, Author author@noreply.github.com Subject: Re: [Mensen/ept_TFCE-matlab] TFCE (#20)

Thanks for the comment... I also just recently experienced the same error when working off a windows machine, on Matlab 2017b, with the MinGW compiler. Normally I work on a linux machine, so it was hard for me to track and fix this error... so I'm not sure whether this was the new Matlab, or the new Matlab default compiler, or some combination with windows... But the c-script (mexed into Matlab) that's being called now just returns the default 0 structure for some reason.

Can you confirm what system, matlab version and compiler you're using in Matlab (mex -setup)... if you have the possibility to switch to another compiler, then re-mex the .c files for your particular system this might solve the issue with the TFCE calculation without too much tinkering. The alternative could be to use another system if available to just run the TFCE calculation for now until I can sort out this issue.

Sorry about these things... its one of the drawbacks of using Matlab with an ever-changing set of tools every 6 months to try and keep up-to-date with on several different operating systems.

Let me know!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Mensen commented 6 years ago

That's not great news if the problem persists on mac... Unfortunately the problem is not clearly debuggable in the c-code, as it seems to be going through all the normal steps but then ultimately just returns 0s ... so perhaps something has changed in the way the new Matlab's handle the mex commands within the c-code, that hasn't yet been implemented for the linux distributions (thankfully). I'll also try and take some time to investigate.

olafdimigen commented 6 years ago

Here are three more data points. I am encountering the exact same issues (only zeros in output) on two out of three windows 64 bit machines. On each machine, the C-code was re-compiled using the MinGW compiler from Mathworks.

Not working (only zeroes as output):

Working (non-zero output, plausible)

Mensen commented 6 years ago

Thanks for having a look. I can confirm again that this works fine in Linux, also on 2018a (I assume you are using 2018a, not b). So I suppose its some sort of compatibility between mex-files and the newer Matlab on Windows and Mac, and not necessarily the compiler directly. I wish Mathworks would have a look at these sorts of things directly and give some warning. As I was trying to debug a little bit, there were some warnings (not errors) about the lines with "mex..." in them so it could be that the structure of these have changed somewhat.

Mensen commented 6 years ago

Hey!

So matlab finally fixed the issue, you can read about it here

You can easily fix quickly by using the -compatibleArrayDims when mexing the file (use the older API), but I'm going to fix the mex files themselves when I get a chance... then it should all work out with a new update as well.

mex ept_mex_TFCE.c -compatibleArrayDims

olafdimigen commented 6 years ago

Great - thanks for the update!

behinger commented 5 years ago

Hi! Could you rename this issue so that its easier to find? Had the same problem :) (win10 64bit R2018b)