Page 1 of 1

Executing MatlabFilter in V3.0

Posted: 21 Sep 2010, 06:15
by gdimitri
I seem to be having a problem loading the MatlabSignalProcessing Filter or the FieldTripBuffer Filter when I use the V3.0 I compiled with CW (in Win7 x32). All other filters seem to work ok (Signal Source, Signal Processing and Application Filters plus a Neuralynx SS Filter I have implemented). I can also load the Matlab filter when I use the V2.0 binaries without any problems.

The problem is that the module is loaded and then a second or two later stops running as I can see from a task manager I am running (only the Matlab and the FieldTrip modules stop running, the Source and Application modules are still active). The Operator's buttons remain grey since not all modules have been loaded.

Having a quick look at the code between V2.0 and V3.0 they seem to be identical. Any ideas as to what might be causing the problem?

Thanks in advance

Posted: 21 Sep 2010, 09:44
by mellinger
Please note that CodeWarrior is not an officially supported build environment for BCI2000. Depending on link order, filters may fail to be instantiated, causing the module to quit.

Other issues related to Matlab and the FieldTripBuffer:
*You need to manually copy pthreadVC2.dll from the FieldTripBuffer's source directory to the prog directory, otherwise the FieldTripBuffer will fail to start.
*Matlab R2010a adds a wrong path to the system path. You will need to add "\win32" at the end of the Matlab entry, otherwise Matlab libraries cannot be located when starting up MatlabSignalProcessing.

Posted: 22 Sep 2010, 09:10
by gdimitri
Thanks for the quick reply.

There was a typo in my original post. I meant CB (CodeBlocks with MinGW compiler) and not CW (sorry about that).

I am using Matlab 2009a and I checked my Path variables; the \win32 is in place.

After you mentioned the ptthread libraries I remembered that the FieldTrip buffer needs those to run. It won't work though with ptthreadVC2.dll but with ptthreadGC2.dll if the executable is made using the MinGW compiler (and thus linking to the ptthreadGC.dll). Thanks for that. Now the FieldTrip buffer Filter works ok.

I still can't get the Matlab filter to work though. Any extra help would be highly appreciated


Thanks again for you time

Posted: 22 Sep 2010, 12:00
by mellinger
Which version of MinGW are you using with CodeBlocks? Are you linking against the Qt dist in the BCI2000 source tree?

Posted: 24 Sep 2010, 08:58
by gdimitri
I am using 3.4.5

As I mentioned in a previous post the 4.x.x that comes with CB isn't supported by your system and if I remember correctly the problem had to do with your Qt distribution. So I am using the 3.4.5 I downloaded from MinGW.

I am not sure I understand your second question. In order to compile I am using the cmake files you provide for the MinGW compiler (by running the Generate MinGW Makefiles.bat). I would assume this would take care of linking any required libraries. I can see in the CB Workspace of the BCI2000 project the Qt4.cmake file (which should be called since the USE_STD_QT in findQt4.cmake is set to false) and the UseQt4.cmake files are in the build targets of CB.

I have done no other linking and even for the Neuralynx SignalSource module I made, I did all the required linking by creating a CMakeLists.txt for it rather than telling the compiller directly what to link.

Is the above relevant to your question? Do I need to link the Qt distribution of BCI2000 as an extra? And if yes do I have to do this through some makefile?

Posted: 24 Sep 2010, 09:32
by mellinger
I needed the information because I wanted to reproduce the problem, no suggestions implied.
With USE_STD_QT set to false, you are linking against the Qt distribution in the BCI2000 source tree.

In the meantime, I upgraded the Qt distribution coming with BCI2000 to 4.6.3. Now, gcc 4.x.x is supported, and 3.x.x is not any more. It would be nice if you could try with the new configuration, and check whether your problem still persists.

Best regards,
Juergen

Posted: 17 Jan 2011, 09:41
by gdimitri
Hello, and sorry for the very long time it took me to reply.

I just updated the bci2000 v3 so that it compiles with mingw 4.x.x
I have recompiled the whole project (compiling with the BCI2000's QT) and I haven't managed to get the MatlabSignalProcessing to work. It behaves exactly like before where the module just dies after a few seconds.

the only thing that happened after the upgrade is that now the windows for the Launcher and the operator take a few seconds (3 or 4) to actually appear after their executables start. Not a problem really but just slightly annoying.

The main issue though remains. I still can't seem to make the Matlab module work in v3


Thanks for your time

George

Posted: 18 Jan 2011, 09:46
by mellinger
There was some invalid gcc inline assembly in the code. I removed it (as it is no longer needed anyway) and now the module works for me when compiled with gcc (MinGW).

Best regards,
Juergen

Posted: 21 Jan 2011, 04:51
by gdimitri
Hello Juergen,

Thanks for that. Now it works for me too.

Thank you very much for your quick reply.

George