Labwindows与Matlab的接口问题!!!
最近一直在弄这个东西,到处找资料来看,现在可以在LABWINDOWS里启动MATLAB,但是弹出“不支持接口”的提示框。希望你那个得到大家的帮助另外,在论坛里也看到了很多类似的求助贴,可是没有最终问题解决了没有也看不多,按照论坛的解决办法,我就只能走到这布了。
下面是我的方法:(主要参照驴性不改博客方法)
LABWINDOWS 8.1.1
MATLAB7.0(先装好的)
打开LABWINDOWS里关于MATLAB的例子,编辑工程,删除matlabsrvr三个文件(.c,.h,.fp)
重新创建ACTIVEX,生成的文件覆盖原来的三个文件覆盖愿文件,然后将生成的三个文件加入工程
修改matlabdemo.c中的“stat = MLApp_DIMLAppQuit (*hMatlabPtr, NULL);” 为:“stat = MLApp_NewDIMLApp (NULL, 1, LOCALE_NEUTRAL, 0, &hMatlab);”
进行下一步的时候,驴的文章中的提到还要在matlabdemo.c中修改的地方我没有找到,我在matlabsrvr.c中找到了如下内容:
const IID MLApp_IID_DIMLApp =
{
0x669CEC93, 0x6E22, 0x11CF, 0xA4, 0xD6, 0x0, 0xA0, 0x24, 0x58, 0x3C, 0x19
};
const IID MLApp_IID_IMLApp =
{
0x669CEC92, 0x6E22, 0x11CF, 0xA4, 0xD6, 0x0, 0xA0, 0x24, 0x58, 0x3C, 0x19
};
const IID MLApp_IID_DIMLEval =
{
0x6E813920, 0x23FE, 0x4D6D, 0x91, 0xF8, 0x56, 0xFA, 0xB0, 0x6C, 0x5D, 0x13
};
const IID MLApp_IID_IMLEval =
{
0x27BEA9CE, 0xA20C, 0x430F, 0x87, 0xC2, 0x1C, 0xC8, 0xBA, 0x31, 0xC3, 0xA8
};
将之全部屏蔽后,定义了上面的四个变量(驴文中是三个,可能版本问题)。
然后运行程序,仍然弹出不支持接口的对话框,不知道怎么解决了
希望大家帮帮忙,希望这个帖子能称为接口问题的最后一个帖子! 也试过了前面一个帖子,修改matlab注册码的方法
那样可以启动MATLAB,也没有弹出“不支持接口”的框,但是不能运行控件功能,点击以后就弹出:“error in sending matrix to matlab"或者类似的消息。
不知道这个又怎么解决... 怎么这么久都没有人帮帮忙啊,这个是matlab里matlabutil.c里sendstring的一段程序,问题可能在这里了,谁看看这问题出在什么地方
int SendString(CAObjHandle hMatlab, char *matStringName, char *CVIString)
{
double *buffer = NULL;
char command;
int index = 0;
int i = 0;
int result = 0;
if(CVIString == NULL)
{
return ERROR_EMPTY_STRING;
}
index=strlen(CVIString);
/* Convert the string into a double array */
buffer=(double *)malloc(index*sizeof(double));
for(i=0;i<index;++i) buffer=(double)CVIString;
/* Send the double array to MATLAB */
result = SendMatrix(hMatlab, matStringName, buffer, NULL, index, 1);
free(buffer);
if (result != SUCCESS) return result;
/* Convert the double array into a MATLAB string */
Fmt(command,"%s<%s=transpose(%s)",matStringName,matStringName);
result = RunMatlabCommand(hMatlab, command);
if (result != SUCCESS) return result;
Fmt(command,"%s<%s=char(%s)",matStringName,matStringName);
result = RunMatlabCommand(hMatlab, command);
if (result != SUCCESS) return result;
return SUCCESS;
} 哦设置后可以打开matlab,但是从cvi发送到matlab出错 怎么 修改matlab注册码 的呀?
页:
[1]