vb调用matlab显示错误,vb调用matlab生成的dll出错。

M函数文件代码:

function flowtype1(k,j,g,o,t,h)

q=0.001:0.001:10;

dpsg=64/t*100*k*(t/100*q*k/g).^(-1).*q.^2/2;

Y=(j-k)*9.8*sin(o)./dpsg;

p=4.56*h*((j-k)*cos(o)*t^0.8*q.^0.4/j).^0.5;

plot(q,p)

hold on

p=(((Y+63.8)/(1+1.5*(j/k)^(1/3))).^0.5+2.86).*q/8.59;

plot(q,p,'r')

在转换dll时,CLASS为flowtype。

在VB中,有6个Text控件和一个按钮,代码如下:

Private z As Double

Private x As Double

Private m As Double

Private ha As Double

Private c As Double

Private b As Double

Private theflowtype1 As flowtype1.flowtype

Private Sub Command1_Click()

Dim y As Variant

If theflowtype1 Is Nothing Then Exit Sub

On Error GoTo Handle_Error

Call theflowtype1.flowtype(k, j, g, o, t, h)

Exit Sub

Handle_Error:

MsgBox (Err.Description)

End Sub

Private Sub Form_Load()

Set theflowtype1 = New flowtype1.flowtype

k = 0.8

j = 1

g = 0.0001

o = 0.5

t = 25

h = 0.5

Exit Sub

Handle_Error:

MsgBox (Err.Description)

End Sub

Private Sub Text1_Change()

'This function is called when ever the contents of the

'Text box change. Sets the current value of Size.

On Error Resume Next

k = CDbl(Text1.Text)

If Err <> 0 Then

k = 0.8

End If

End Sub

Private Sub Text2_Change()

On Error Resume Next

j = CDbl(Text2.Text)

If Err <> 0 Then

j = 1

End If

End Sub

Private Sub Text3_Change()

On Error Resume Next

g = CDbl(Text3.Text)

If Err <> 0 Then

g = 0.0001

End If

End Sub

Private Sub Text4_Change()

On Error Resume Next

o = CDbl(Text4.Text / 180 * pi)

If Err <> 0 Then

o = 0.5

End If

End Sub

Private Sub Text5_Change()

On Error Resume Next

t = CDbl(Text5.Text)

If Err <> 0 Then

t = 25

End If

End Sub

Private Sub Text6_Change()

On Error Resume Next

h = CDbl(Text6.Text)

If Err <> 0 Then

h = 0.5

End If

End Sub

在VB中引用dl后运行,出现对象不支持该属性和方法的提示,请教大牛哪里出错了,谢谢大家。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值