MatlabSignalProcessing

Locked
lucamossa
Posts: 19
Joined: 27 Jan 2014, 08:46

MatlabSignalProcessing

Post by lucamossa » 13 Mar 2014, 06:28

Hi,

I'm trying to use Matlab for signals processing on Ubuntu 12.04.03 LTS, but the Operator's buttons remain grey when I try to execute a .bat file.
Maybe, the problem is that I haven't the new version of MatlabFilter, but I don't know how to update my old version on Ubuntu.
Someone have any ideas?

Thanks
Best regards

Ps: My .bat file is:

#! ../prog/BCI2000Shell
@cls & ..\prog\BCI2000Shell %0 %* #! && exit /b 0 || exit /b 1\n
#######################################################################################
## $Id: MatlabDemo_SignalGenerator.bat 4126 2012-06-15 17:42:57Z mellinger $
## Description: BCI2000 startup Operator module script. For an Operator scripting
## reference, see
## http://doc.bci2000.org/index/User_Refer ... _Scripting
##
## $BEGIN_BCI2000_LICENSE$
##
## This file is part of BCI2000, a platform for real-time bio-signal research.
## [ Copyright (C) 2000-2012: BCI2000 team and many external contributors ]
##
## BCI2000 is free software: you can redistribute it and/or modify it under the
## terms of the GNU General Public License as published by the Free Software
## Foundation, either version 3 of the License, or (at your option) any later
## version.
##
## BCI2000 is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY
## - without even the implied warranty of MERCHANTABILITY or FITNESS FOR
## A PARTICULAR PURPOSE. See the GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License along with
## this program. If not, see <http_nospam_www.gnu.org/licenses/>.
##
## $END_BCI2000_LICENSE$
#######################################################################################
Change directory $BCI2000LAUNCHDIR
Show window; Set title ${Extract file base $0}
Startup system localhost
Start executable gUsbAmpUnix --local
Start executable MatlabSignalProcessing --local --MatlabWD="./matlab" 127.0.0.1
Start executable CursorTask --local
Wait for Connected
Load parameterfile "../parms/examples/CursorTask_SignalGenerator.prm"
Load parameterfile "../parms/fragments/amplifiers/gUSBamp.prm"

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: MatlabSignalProcessing

Post by boulay » 13 Mar 2014, 12:01

Just to make sure it's a problem with MatlabSignalProcessing, can you get BCI2000 to work using the same Source and Application modules but using a different SignalProcessing module (e.g. SpectralSignalProcessing)?

If that combination works, then I'd agree that it is MatlabSignalProcessing that is the problem. In Windows, a common problem with the MatlabSignalProcessing module is that people were building 32-bit MatlabSignalProcessing modules which were incompatible with 64-bit Matlab. Make sure you are building MatlabSignalProcessing for the same architecture as the installed Matlab binaries.

I can't help you debug anything on linux because I don't have linux currently. I don't know if the latest BCI2000 revision builds on linux but you can try by checking it out to a new directory and building again.

I seem to be the only one answering questions these days, but I'm not really equipped to answer this one.

lucamossa
Posts: 19
Joined: 27 Jan 2014, 08:46

Re: MatlabSignalProcessing

Post by lucamossa » 14 Mar 2014, 09:07

Thank you very much for your fast reply.
I done several experiments with the SpectralSignalProcessing module and there aren't problems.
I think that the problem is the choice of Matlab working directory.
Example: If Matlab's executable is in the following directory: "usr/local/MATLAB/R2011b/bin" I must put this directory in my relative .bat file?

start MatlabSignalProcessing.exe --MatlabWD="usr/local/MATLAB/R2011b/bin"

or not?

Thanks for your time.

Luca

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: MatlabSignalProcessing

Post by boulay » 16 Mar 2014, 12:10

No. The MatlabWD parameter points to where your custom functions may be found.

Code: Select all

function [parameters, states] = bci_Construct;
function [out_signal_dim] = bci_Preflight( in_signal_dim );
function bci_Initialize( in_signal_dim, out_signal_dim ); 
function [out_signal] = bci_Process( in_signal );
But the directory where the Matlab executable may be found (i.e., usr/local/MATLAB/R2011b/bin) must be on the path. If you open a shell, cd to the BCI2000 prog directory, then type 'which matlab', does it find it?

lucamossa
Posts: 19
Joined: 27 Jan 2014, 08:46

Re: MatlabSignalProcessing

Post by lucamossa » 17 Mar 2014, 08:02

Hi, Now I inserted in the Matlab parameter the right directory:

start MatlabSignalProcessing.exe --MatlabWD="/home/user/BCI2000/prog/matlab"

and when I type 'which matlab' in the BCI2000 prog directory (/home/user/BCI2000/prog) return usr/local/MATLAB/R2011b/bin.

But, when I try to execute the .bat file the Operator button remain grey again.

Have you any ideas?

Another possible cause could be that MakeFile fail to generate MatlabFilter executable. Have you a version of MatlabFilter and MatlabSignalProcessing executable for Linux Ubuntu (version 12.04)?

Thanks for your help! I really appreciate this.

Luca

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: MatlabSignalProcessing

Post by boulay » 17 Mar 2014, 09:17

lucamossa wrote: start MatlabSignalProcessing.exe --MatlabWD="/home/user/BCI2000/prog/matlab"
Would it still have a .exe in linux? I doubt it. You definitely need to compile your own MatlabSignalProcessing module and for that you also need to compile the MatlabFilter. I'm sorry but I don't have the ability to create linux binaries right now.

Instead of using the make scripts in the bci2000/build directory, try using cmake-gui. First, make a directory where you want the project to be built (e.g. bci2000\ubuntubuild). Then, in cmake-gui, set the "build" directory to this directory you just created, then set the "source" directory to bci2000\build. Then press configure. It'll fail at some point. Take a look at the new cmake options presented in red in the gui. Look for anything matlab related. I am guessing that cmake is unable to find the matlab binary on its own, and you'll have to point it there. You'll have to repeat this configure-then-fix cycle a few times until you get all your options set. I think you'll be able to make the BCI2000 matlab binaries then.

lucamossa
Posts: 19
Joined: 27 Jan 2014, 08:46

Re: MatlabSignalProcessing

Post by lucamossa » 17 Mar 2014, 10:44

Hi,

I'm sorry, the previous line was only an example for explain my modification. My real .bat file is contained in the first post of this conversation.

Thank you very much for your help, in these day will try to fix this problem, following your hint.

See you soon and thanks again.

Best regards.

Luca

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: MatlabSignalProcessing

Post by boulay » 17 Mar 2014, 12:11

I'm using OSX and I was able to configure the project with the Matlab targets using the described method. However, I'm unable to build but that is a separate OSX-related problem.

Would you mind telling me what revision of the BCI2000 source you are using (svn info)? I may revert to that version and/or try linux if I can't get OSX to work.

Good luck,
Chad

lucamossa
Posts: 19
Joined: 27 Jan 2014, 08:46

Re: MatlabSignalProcessing

Post by lucamossa » 09 Apr 2014, 08:45

Hi Chad, some weeks ago I founded the solution about my problem.
I wrote you because this solution could be important for users that use BCI2000 on Ubuntu. I used the following .bat file:

#! ../prog/BCI2000Shell
@cls & ..\prog\BCI2000Shell %0 %* #! && exit /b 0 || exit /b 1\n
#######################################################################################
## $Id: MatlabDemo_SignalGenerator.bat 4126 2012-06-15 17:42:57Z mellinger $
## Description: BCI2000 startup Operator module script. For an Operator scripting
## reference, see
## http://doc.bci2000.org/index/User_Refer ... _Scripting
##
## $BEGIN_BCI2000_LICENSE$
##
## This file is part of BCI2000, a platform for real-time bio-signal research.
## [ Copyright (C) 2000-2012: BCI2000 team and many external contributors ]
##
## BCI2000 is free software: you can redistribute it and/or modify it under the
## terms of the GNU General Public License as published by the Free Software
## Foundation, either version 3 of the License, or (at your option) any later
## version.
##
## BCI2000 is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY
## - without even the implied warranty of MERCHANTABILITY or FITNESS FOR
## A PARTICULAR PURPOSE. See the GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License along with
## this program. If not, see <http_nospam_www.gnu.org/licenses/>.
##
## $END_BCI2000_LICENSE$
#######################################################################################
Change directory $BCI2000LAUNCHDIR
Show window; Set title ${Extract file base $0}
Startup system localhost
Start executable gUsbAmpUnix --local
Start executable MatlabSignalProcessing --local --MatlabWD=matlab
Start executable CursorTask --local
Wait for Connected
Load parameterfile "../parms/examples/CursorTask_SignalGenerator.prm"
Load parameterfile "../parms/fragments/amplifiers/gUSBamp.prm"


Then I installed Tcsh schell and I wrote following command from terminal:

gedit ~/.tcshrc

and in the text file that appears I wrote:

set path=($path /usr/local/MATLAB/R2011b/bin)
cd /home/user/BCI2000/batch/
./CursorTask_gUSBamp.bat

Finally, for launch the .bat file, I wrote the command "tcsh" from terminal.

I hope that this solution can help someone.
Thank you very much.
Best regards.

Luca Mossa

Locked

Who is online

Users browsing this forum: No registered users and 1 guest