| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1198 人关注过本帖
标题:求助:vb调用MATLAB问题(数组数据传不过去)
只看楼主 加入收藏
xiaohuage22
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-5-22
收藏
 问题点数:0 回复次数:0 
求助:vb调用MATLAB问题(数组数据传不过去)
要求:在VB界面输入传递函数(数组形式,现在问题可能就 是数组没能够传到MATLAB中)


VB程序如下(有些参数多设置了)
图片附件: 游客没有浏览图片的权限,请 登录注册


Dim matlab As Object
Option Base 0
 
Public p As Integer
Public g As Integer



Private Sub Command1_Click()
Dim H() As Double
Dim i As Double, k As Double, w As Double, j As Double
k = Text1.Text
p = k
w = Text2.Text
g = w
Dim L1() As Double
Dim L2() As Double



ReDim L1(0 To k - 1) As Double
ReDim L2(0 To w - 1) As Double



For i = 0 To k - 1

L1(i) = List1.List(i)

Next i


For j = 0 To w - 1

L2(j) = List2.List(j)

Next j


Set matlab = CreateObject("Matlab.Application")



Call matlab.putfullmatrix("I", "base", L1, H)

Call matlab.putfullmatrix("J", "base", L2, H)


matlab.execute ("xyz")

Call matlab.minimizecommandwindow

matlab.execute ("print( gcf, '-djpeg', 'c:\Test1')")

Call matlab.quit
Set matlab = Nothing


Form7.Show

End Sub

Private Sub Command2_Click()
Dim a() As Integer
Dim i As Integer, j As Integer, n As Integer
j = Text1.Text
ReDim a(j)
For i = 1 To UBound(a)
n = InputBox("输入一个数据:")
List1.AddItem n
Next i
End Sub


Private Sub Command3_Click()
Dim a() As Integer
Dim i As Integer, j As Integer, n As Integer
j = Text2.Text
ReDim a(j)
For i = 1 To UBound(a)
n = InputBox("输入一个数据:")
List2.AddItem n
Next i
End Sub




MATLAB M 文件



sys=tf(I,J);
sys2=feedback(sys,1)
step(sys2)



如果在MATLAB中给I,J赋值,会有图形在VB中出现。
搜索更多相关主题的帖子: MATLAB Double Dim 数据 Integer 
2008-05-22 17:23
快速回复:求助:vb调用MATLAB问题(数组数据传不过去)
数据加载中...
 
   



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

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