如何在Windows 8.1下的Matlab 2014b中安装SPAMS工具箱

YAS*_*YAS 5 c++ matlab mex

我正在尝试学习如何在使用 Windows 8.1 操作系统和 MATLAB R2014b 的机器上成功编译“稀疏建模软件”(SPAMS)。

我采取的步骤如下(某些部分可能是不必要的或丢失的)

步骤 1.安装“Microsoft Visual C++ 2013 Professional”。

步骤 2.安装“Microsoft Windows 软件开发工具包 (SDK)”。

步骤 3.http://spams-devel.gforge.inria.fr/下载“spams-matlab-v2.4-svn2014-02-18.tar”

步骤 4.在 Windows 中使用 7-zip 解压缩它。我只收到 1 个错误,但所有其他数据都未压缩。错误是这样的:

ERROR: Can not set reparse data: C:\Users\Yashar\Desktop\spams-matlab\cpp_library\spams.h
Run Code Online (Sandbox Code Playgroud)

Step5:在MATLAB中,我设置编译器:

>> mex -setup C++
Run Code Online (Sandbox Code Playgroud)

我收到的消息:

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.
Run Code Online (Sandbox Code Playgroud)

步骤 6.在 SPAMS 中打开 compile.m(按照推荐)并运行它。我得到的错误如下所示:

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{:});
Run Code Online (Sandbox Code Playgroud)

问题:我所做的对我来说看起来很标准,但我知道学习如何处理与 MATLAB 等接口代码相关的问题需要一段时间。你能帮我解决我遇到的问题并设法编译吗?我的机器上有垃圾邮件工具箱吗?仅供参考,我有兴趣在此工具箱中使用 mexLasso 函数。

小智 4

唔。编译这个工具箱有点棘手。

以下是我在 Windows 7 + MATLAB 2013a 中的操作方法 希望对你有帮助。

(我没有解压的问题)

首先,您要确保“mex”正常工作,我编译了一些较小的软件包,它们通常可以正常工作。

二、换线

compiler='gcc';
Run Code Online (Sandbox Code Playgroud)

compiler='mex';
Run Code Online (Sandbox Code Playgroud)

第三,你可以发现很多线条的样子

-I./linalg/ -I./decomp/ -I./prox/ -I./spams/dictLearn/ dictLearn/mex/mexArchetypalAnalysis.cpp
Run Code Online (Sandbox Code Playgroud)

这里的“I./lib_name/”是Linux风格的路径,你需要将其更改为Windows可以理解的东西。

这是一个例子:

-I./linalg/       --->       -IC:\Users\XXX\Downloads\SPAMS\linalg
Run Code Online (Sandbox Code Playgroud)

总共有六处需要更改,如下:

  1. -I./linalg/
  2. -I./分解/
  3. -I./prox/
  4. -I./dictLearn/
  5. -I./达格斯/
  6. -I./图片/

替换这些字符串后,只需运行compile.m,然后它应该可以工作。