Maltab communication with VB.NET

2 views (last 30 days)
squall141 on 5 Nov 2016
Edited: squall141 on 5 Nov 2016
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 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 ) 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!

Answers (0)

Community Treasure Hunt

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

Start Hunting!