Maltab communication with VB.NET

2 ビュー (過去 30 日間)
squall141
squall141 2016 年 11 月 5 日
編集済み: squall141 2016 年 11 月 5 日
Hello everybody, i'm trying to exchange data between Matlab and VB.NET I have realized a banal script called matlab_vd and collocated it in C:\Users\robim\Desktop (this is also the matlab current directory). The script is:
x = 2;
y = 4;
product = x*y
In vb.net i realized a simple form with a button and a text box. I want to run matlab script when i push the botton and print the value of product in the text box; so (following the documentation at https://it.mathworks.com/help/matlab/matlab_external/call-a-matlab-function-from-visual-basic-net-client.html ) i wrote this in visual studio:
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim MatLab As Object
Dim Result As String
MatLab = CreateObject("Matlab.Application")
Dim acquired_value As Single
Result = MatLab.Execute("cd C:\Users\robim\Desktop")
Result = MatLab.Execute("matlab_vb")
MatLab.GetFullMatrix("product", acquired_value)
TextBox1.Text = acquired_value.ToString
End Sub
End Class
However this code doesn't work. I have opened matlab and executed the visual studio app but i have an error at:
MatLab.GetFullMatrix("product", acquired_value)
I'm new with vb; do i need to add some libraries to my vb code? have i made a mistake in the code? Can someone give me any advice? Thanks a lot guys!

回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with Microsoft .NET についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by