Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install SPAMS toolbox in Matlab 2014b under windows 8.1

Tags:

c++

matlab

mex

I am trying to learn how to successfully compile "Sparse Modeling Software" (SPAMS) in my machine which uses a Windows 8.1 OS and MATLAB R2014b.

The steps I have taken are as followed (some parts might have been unnecessary or missing)

Step 1. Installed "Microsoft Visual C++ 2013 Professional".

Step 2. Installed "Microsoft Windows Software Development Kit (SDK)".

Step 3. Download "spams-matlab-v2.4-svn2014-02-18.tar" from http://spams-devel.gforge.inria.fr/

Step 4. Unzip it in Windows using 7-zip. Only 1 error I received but all he other data were uncompressed. The error is this :

ERROR: Can not set reparse data: C:\Users\Yashar\Desktop\spams-matlab\cpp_library\spams.h

Step5: In MATLAB, I set the compiler:

>> mex -setup C++

message I recieve:

MEX configured to use 'Microsoft Visual C++ 2013 Professional' for C++  language compilation.
Warning: The MATLAB C and Fortran API has changed to support MATLAB
 variables with more than 2^32-1 elements. In the near future
 you will be required to update your code to utilize the
 new API. You can find more information about this at:
 http://www.mathworks.com/help/matlab/matlab_external/upgrading-   mex-files-to-use-64-bit-api.html.

Step 6. Open compile.m in SPAMS (as recommended) and run it. The error I get looks like this:

compilation of: -I./linalg/ -I./decomp/ -I./prox/ -I./dictLearn/ dictLearn/mex/mexTrainDL.cpp
Error using mex
C:\Users\Yashar\Desktop\spams-matlab\Files not found; check that you are in the
correct current folder, and check the spelling of
'C:\Users\Yashar\Desktop\spams-matlab\Files'.
Error in compile (line 391)
mex(args{:});

Question : What I am doing to me looks pretty standard but I know it takes a while learning how to cope with issues with regard to interfacing codes with MATLAB, etc. Can you please help me with getting around the problems I have and managing to compile SPAMS toolbox in my machine? FYI, I am interested in using mexLasso function in this toolbox.

like image 318
YAS Avatar asked Sep 28 '22 17:09

YAS


1 Answers

Hmm. Compiling this toolbox is a bit tricky.

Here is how I do it in Windows 7 + MATLAB 2013a. Hope it works for you.

(I don't have the issue of unzip)

First, you want to make sure that 'mex' works properly, I have compiled some smaller packages and they worked in general.

Second, change the line

compiler='gcc';

to

compiler='mex';

Third, you can find a lot of lines look like

-I./linalg/ -I./decomp/ -I./prox/ -I./spams/dictLearn/ dictLearn/mex/mexArchetypalAnalysis.cpp

Here 'I./lib_name/' is Linux style path, and you need to change it into something that Windows can understand.

Here is an example:

-I./linalg/       --->       -IC:\Users\XXX\Downloads\SPAMS\linalg

There are totally six pieces that you need to change as following,

  1. -I./linalg/
  2. -I./decomp/
  3. -I./prox/
  4. -I./dictLearn/
  5. -I./dags/
  6. -I./image/

After replacing these strings, just run compile.m, then it should work.

like image 151
Will Yongxin Yang Avatar answered Oct 05 '22 07:10

Will Yongxin Yang