| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1213 人关注过本帖
标题:Vc++与Matlab混合编程(matcom)
只看楼主 加入收藏
shanghai
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2006-4-12
收藏
 问题点数:0 回复次数:1 
Vc++与Matlab混合编程(matcom)

我用matcom把m文件编译成.exe文件如下:
#line 1 "c:/matcom45/新建文件夹/linennet_143.m"
dMm(P); dMm(T); dMm(w_range); dMm(b_range); dMm(ES); dMm(w); dMm(b); dMm(A); dMm(E); dMm(SSE); dMm(p); dMm(a); \
#line 2 "c:/matcom45/新建文件夹/linennet_143.m"
call_stack_begin;
#line 2 "c:/matcom45/新建文件夹/linennet_143.m"
_ clf(TM("reset"));
#line 3 "c:/matcom45/新建文件夹/linennet_143.m"
_ display( figure((CL(gcf()))) );
#line 4 "c:/matcom45/新建文件夹/linennet_143.m"
//setfsize(300,300);
#line 5 "c:/matcom45/新建文件夹/linennet_143.m"
_ echo(TM("on"));
mt_print_handler("clc\n");
#line 6 "c:/matcom45/新建文件夹/linennet_143.m"
_ display(clc());
mt_print_handler("\n");

mt_print_handler("% INITLIN -对神经元的权值和阈值进行初始化\n");
#line 8 "c:/matcom45/新建文件夹/linennet_143.m"
// INITLIN -对神经元的权值和阈值进行初始化
mt_print_handler("% SIMULIN -对神经元进行仿真\n");
#line 9 "c:/matcom45/新建文件夹/linennet_143.m"
// SIMULIN -对神经元进行仿真
mt_print_handler("% TRAINWH -利用神经元学习规则对线性神经元训练\n");
#line 10 "c:/matcom45/新建文件夹/linennet_143.m"
// TRAINWH -利用神经元学习规则对线性神经元训练
mt_print_handler("pause \n");
#line 11 "c:/matcom45/新建文件夹/linennet_143.m"
_ display(pauseM());
mt_print_handler("clc\n");
#line 12 "c:/matcom45/新建文件夹/linennet_143.m"
_ display(clc());
mt_print_handler("% P 为输入向量\n");
#line 13 "c:/matcom45/新建文件夹/linennet_143.m"
// P 为输入向量
mt_print_handler("P=[1.0 -1.2];\n");
#line 14 "c:/matcom45/新建文件夹/linennet_143.m"
_ P = (BR(1.0),-1.2);
mt_print_handler("% T 为目标向量\n");
#line 15 "c:/matcom45/新建文件夹/linennet_143.m"
// T 为目标向量
mt_print_handler("T = [0.5 1.0];\n");
#line 16 "c:/matcom45/新建文件夹/linennet_143.m"
_ T = (BR(0.5),1.0);
mt_print_handler("pause \n");
#line 17 "c:/matcom45/新建文件夹/linennet_143.m"
_ display(pauseM());
mt_print_handler("clc\n");
#line 18 "c:/matcom45/新建文件夹/linennet_143.m"
_ display(clc());
mt_print_handler("\n");

mt_print_handler("w_range=-1:0.1:1;\n");
#line 20 "c:/matcom45/新建文件夹/linennet_143.m"
_ w_range = colon(-1.0,0.1,1.0);
mt_print_handler("b_range=-1:0.1:1;\n");
#line 21 "c:/matcom45/新建文件夹/linennet_143.m"
_ b_range = colon(-1.0,0.1,1.0);
mt_print_handler("ES=errsurf(P,T,w_range,b_range,'purelin');\n");
#line 22 "c:/matcom45/新建文件夹/linennet_143.m"
_ ES = errsurf(P,T,w_range,b_range,TM("purelin"));
mt_print_handler("plotes(w_range,b_range,ES);\n");
#line 23 "c:/matcom45/新建文件夹/linennet_143.m"
_ plotes(w_range,b_range,ES);
mt_print_handler("pause\n");
#line 24 "c:/matcom45/新建文件夹/linennet_143.m"
_ display(pauseM());
mt_print_handler("clc\n");
#line 25 "c:/matcom45/新建文件夹/linennet_143.m"
_ display(clc());
mt_print_handler("\n");

mt_print_handler("% 初始化权值和阈值\n");
#line 27 "c:/matcom45/新建文件夹/linennet_143.m"
// 初始化权值和阈值
mt_print_handler("[w,b]=solvelin(P,T);");
#line 28 "c:/matcom45/新建文件夹/linennet_143.m"
_ /*[w,b] = */solvelin(P,T,i_o,w,b);
mt_print_handler(" \n");

mt_print_handler("\n");

mt_print_handler("pause\n");
#line 30 "c:/matcom45/新建文件夹/linennet_143.m"
_ display(pauseM());
mt_print_handler("clc\n");
#line 31 "c:/matcom45/新建文件夹/linennet_143.m"
_ display(clc());
mt_print_handler("\n");

mt_print_handler("A=simulin(P,w,b);\n");
#line 33 "c:/matcom45/新建文件夹/linennet_143.m"
_ A = simulin(P,w,b);
mt_print_handler("E=T-A;\n");
#line 34 "c:/matcom45/新建文件夹/linennet_143.m"
_ E = T-A;
mt_print_handler("SSE=sumsqr(E)\n");
#line 35 "c:/matcom45/新建文件夹/linennet_143.m"
_ SSE = sumsqr(E); display(SSE);
mt_print_handler("pause\n");
#line 36 "c:/matcom45/新建文件夹/linennet_143.m"
_ display(pauseM());
mt_print_handler("clc\n");
#line 37 "c:/matcom45/新建文件夹/linennet_143.m"
_ display(clc());
mt_print_handler("plotes(w_range,b_range,ES);\n");
#line 38 "c:/matcom45/新建文件夹/linennet_143.m"
_ plotes(w_range,b_range,ES);
mt_print_handler("plotep(w,b,SSE);\n");
#line 39 "c:/matcom45/新建文件夹/linennet_143.m"
_ plotep(w,b,SSE);
mt_print_handler("pause;\n");
#line 40 "c:/matcom45/新建文件夹/linennet_143.m"
_ pauseM();
mt_print_handler("clc\n");
#line 41 "c:/matcom45/新建文件夹/linennet_143.m"
_ display(clc());
mt_print_handler("p=-1.1;\n");
#line 42 "c:/matcom45/新建文件夹/linennet_143.m"
_ p = -1.1;
mt_print_handler("a=simulin(p,w,b)\n");
#line 43 "c:/matcom45/新建文件夹/linennet_143.m"
_ a = simulin(p,w,b); display(a);
mt_print_handler("echo off\n");
#line 44 "c:/matcom45/新建文件夹/linennet_143.m"
_ echo(TM("off"));
call_stack_end;

添加到Vc++工程后编译出现如下错误提示:
--------------------Configuration: linennet - Win32 Debug--------------------
Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
linennet.cpp
linennetDlg.cpp
errsurf.cpp
feval.cpp
linennet_143.cpp
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2065: 'P' : undeclared identifier
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2501: 'dMm' : missing storage-class or type specifiers
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2065: 'T' : undeclared identifier
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2501: 'dMm' : missing storage-class or type specifiers
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2086: 'dMm' : redefinition
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2065: 'w_range' : undeclared identifier
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2501: 'dMm' : missing storage-class or type specifiers
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2086: 'dMm' : redefinition
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2065: 'b_range' : undeclared identifier
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2501: 'dMm' : missing storage-class or type specifiers
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2086: 'dMm' : redefinition
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2065: 'ES' : undeclared identifier
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2501: 'dMm' : missing storage-class or type specifiers
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2086: 'dMm' : redefinition
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2065: 'w' : undeclared identifier
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2501: 'dMm' : missing storage-class or type specifiers
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2086: 'dMm' : redefinition
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2065: 'b' : undeclared identifier
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2501: 'dMm' : missing storage-class or type specifiers
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2086: 'dMm' : redefinition
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2065: 'A' : undeclared identifier
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2501: 'dMm' : missing storage-class or type specifiers
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2086: 'dMm' : redefinition
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2065: 'E' : undeclared identifier
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2501: 'dMm' : missing storage-class or type specifiers
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2086: 'dMm' : redefinition
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2065: 'SSE' : undeclared identifier
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2501: 'dMm' : missing storage-class or type specifiers
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2086: 'dMm' : redefinition
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2065: 'p' : undeclared identifier
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2501: 'dMm' : missing storage-class or type specifiers
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2086: 'dMm' : redefinition
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2065: 'a' : undeclared identifier
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2501: 'dMm' : missing storage-class or type specifiers
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2086: 'dMm' : redefinition
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2501: 'call_stack_begin' : missing storage-class or type specifiers
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2146: syntax error : missing ';' before identifier 'clf'
c:/matcom45/新建文件夹/linennet_143.m(2) : error C2501: '_' : missing storage-class or type specifiers
c:/matcom45/新建文件夹/linennet_143.m(2) : fatal error C1004: unexpected end of file found
nntobsf.cpp
nntobsu.cpp
plotep.cpp
plotes.cpp
purelin.cpp
simulin.cpp
solvelin.cpp
sumsqr.cpp
Error executing cl.exe.

linennet.exe - 39 error(s), 0 warning(s)

请帮我看看,是什么错误,应该怎么改?不胜感激

搜索更多相关主题的帖子: Matlab matcom 
2006-04-18 17:18
ot1122
Rank: 1
等 级:新手上路
帖 子:31
专家分:0
注 册:2006-4-20
收藏
得分:0 
大哥,是不是太麻纺了
2006-04-22 09:28
快速回复:Vc++与Matlab混合编程(matcom)
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.039123 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved