jutlwj 发表于 2007-4-1 00:06:09

将Matlab m文件制作为DLL文件时遇到的问题!

我在Matlab中写了一个简单的m文件,其中调用了几个matlab函数,然后想把它制成DLL供LabVIEW调用。不知在用LV调用DLL时,能否在LabVIEW中将数据传给m文件中的Matlab函数?还有在转换过程中,遇到了下面的问题:
第1步:
>>mex -setup
Please choose your compiler for building external interface (MEX) files:

Would you like mex to locate installed compilers /n? y

Select a compiler:
Digital Visual Fortran version 6.0 in C:\Program Files\Microsoft Visual Studio
Lcc C version 2.4 in C:\MATLAB6P5P1\sys\lcc
Microsoft Visual C/C++ version 6.0 in C:\Program Files\Microsoft Visual Studio

None

Compiler: 3

第2步:
>> mbuild -setup
Please choose your compiler for building standalone MATLAB applications:

Would you like mbuild to locate installed compilers /n? y

Select a compiler:
Lcc C version 2.4 in C:\MATLAB6P5P1\sys\lcc
Microsoft Visual C/C++ version 6.0 in C:\Program Files\Microsoft Visual Studio

None

Compiler: 2

Please verify your choices:

Compiler: Microsoft Visual C/C++ 6.0
Location: C:\Program Files\Microsoft Visual Studio
第3步:
>>mcc -t -h -L C -W lib:a -T link:lib lwj.m
??? Error: File "lwj" is a script M-file and cannot be compiled with the current Compiler.

Error in ==> C:\MATLAB6p5p1\toolbox\compiler\mcc.dll

最后的错误提示是怎么回事?怎么解决?请高手指点。

飞雨天 发表于 2007-4-1 00:10:41

回复 #1 jutlwj 的帖子

顶下,今天没事,刚好学习下如何用matlab制作dll,看谁先把问题解决了~哈

dinga 发表于 2007-7-14 11:21:42

这个问题我遇到了
解决办法是~:

你要把你的M文件按照Matlab的Function文件来写。

例:
function =labview(q,w,q)
%
%
%
……

……
楼主可以看一下Matlab相关书介绍。
页: [1]
查看完整版本: 将Matlab m文件制作为DLL文件时遇到的问题!