Dim matlab As ObjectPrivate Sub Command1_Click() Dim h As String Dim resule As String Set matlab = CreateObject("matlab.application") matlab.Visible = True result = matlab.execute("splinetool") End SubPrivate Sub Form_Unload(Cancel As Integer) Set matlab = Nothing End Submatlab和VB通讯不是很方便,不过也有几种常用的方法。 1、DDE 2、将Matlab函数转换为VB可用的DLL 3、通过M文件 4、安装MatrixVB
Dim h As String
Dim resule As String
Dim matlab As Object
Set matlab = CreateObject("matlab.application")
result = matlab.execute("set(gcf,'visible','off');")
h = Text1.Text
result = matlab.execute(h)
result = matlab.execute("print(gcf,'-dtiff','c:\a.tif');")
result = matlab.execute("x=imread('c:\a.tif');")
result = matlab.execute("imwrite(x,'c:\a.bmp');")
Image1.Picture = LoadPicture("c:\a.bmp")result = matlab.execute("delete c:\a.tif")
result = matlab.execute("delete c:\a.bmp")
End SubPrivate Sub Form_Load()
Text1.Text = "surf(peaks);shading interp;colormap(hot)" 'ÕâÀïÒªÌîһЩ»­Í¼µÄmatlabÓï¾ä¡£
Image1.Stretch = True '²»È»»­³öÀ´µÄͼºÃ´ó
End Sub
Dim h As String
Dim resule As String
Set matlab = CreateObject("matlab.application")
matlab.Visible = True
result = matlab.execute("splinetool")
End SubPrivate Sub Form_Unload(Cancel As Integer)
Set matlab = Nothing
End Submatlab和VB通讯不是很方便,不过也有几种常用的方法。
1、DDE
2、将Matlab函数转换为VB可用的DLL
3、通过M文件
4、安装MatrixVB