Maltab communication with VB.NET

조회 수: 6 (최근 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 CenterFile Exchange에서 Call MATLAB from .NET에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by