描述
我有一个数学符号工具箱,用于MATLAB--Version2.0 这里
然后在MATLAB环境下使用它所包含的文档进行编译。
安装步骤:
mathlink.h文件和E:\math\Mathematica\5.\AddOns\MathLink\DeveloperKit\Windows\CompilerAdditions\mldev32\lib.中的ml32i1m.lib文件将两个文件复制到一个预定的目录中(我们将此目录称为C:\xxx)。mex –setup命令。选择“C:\Program \中的Microsoft/C++版本6.0”。这告诉Matlab它需要使用C编译器(而不是Fortran编译器)。您需要安装Microsoft /C++。不要选择“LCC24inC:\MATLAB6P1\sys\lcc”选项。4)打开Matlab命令窗口,运行mathrun.m。这个程序将编译C文件math.c.我得到的文件是belew:

然后我一步一步地
(1)在以下路径中找到mathlink.h和ml32i1m.lib
D:\WolframResearch\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows\CompilerAdditions\mldev32\include D:\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows\CompilerAdditions\mldev32\lib
(2)将压缩文件math.zip的内容复制到C:XXX中

(3)在MATLAB中编译。
mex -setup

(4)最后一次setp
addpath C:\XXX
run mathrun.m
我也不知道原因?
更新
mathrun.m中的matlab程序
addpath C:\XXX;
% adds the directory C:\XXX to the list of directories which Matlab "sees" (referred to as paths)
mlpath='C:\XXX' % The directory where mathlink.h is
mllib='C:\XXX\ml32i1m.lib' % The library ml32i1m.lib
% make command
command=sprintf('mex -D__STDC __ -I % s % s % s', mlpath, 'math.c', mllib);
% compile
eval(command) 发布于 2015-05-20 08:58:34
路径似乎没有正确地传递到mex,所以它找不到math.c。评论原文:
%command=sprintf('mex -D__STDC __ -I % s % s % s', mlpath, 'math.c', mllib);并添加以下内容:
command=sprintf('mex -D__STDC __ -I%s %s %s', mlpath, 'math.c', mllib);因为mex文档指定在-I开关和输入路径之间不应该有空间。为了安全起见,你甚至可以写:
command=sprintf('mex -D__STDC __ -I%s %s %s', mlpath, fullfile(mlpath,'math.c'), mllib);https://stackoverflow.com/questions/30339472
复制相似问题