vb与matlab混合编程求助
			 
			 
			
		
		
		
			
			我是vb跟matlab的新手,最近研究混合编程的问题!我的m文件很简单: 
function y=testm(x) 
y=5*x; 
 
用matlab的comtool将m文件转换成dll供vb调用。 
vb代码如下: 
Private a As Double 
Private b As Double 
Private thetest As mytest.Test '建立对象 
 
Private Sub Command1_Click() 
If thetest Is Nothing Then Exit Sub 
On Error GoTo handle_error 
b = thetest.testm(1, b, a) '调用matlab函数 
Label1.Caption = b 
Exit Sub 
handle_error: 
MsgBox (Err.Description) 
End Sub 
Private Sub Form_Load()       '初始化 
On Error GoTo handle_error 
Set thetest = New mytest.Test 
a = 1 
b = 5 
 
Exit Sub 
handle_error: 
MsgBox (Err.Description) 
End Sub 
 
Private Sub Text1_Change() 
On Error Resume Next 
a = CDbl(Text1.Text) 
If Err <> 0 Then 
a = 1 
End If 
End Sub 
 
调试时报错说b = thetest.testm(1, b, a),缺少函数或变量。 
将上面语句改为 call thetest.testm(1, b, a),调试通过,但b的值没有随a的值改变,即无论text框输入多少label1的值始终是5! 
烦请各位高手赐教~
		 
		
		
		
		
		
		
		
	 |