Share |
Login Form
Newsletter



Receive HTML?

Latest Members


Interfacing MATLAB and VIsual Basic 2010 Hot

 
User rating
 
0.0 (0)

In a previous article, I mentioned how to compile a MATLAB program so that it could be run as a stand-alone application. What if that's not what you want? What if you want  to use MATLAB's extensive functions, high-performance calculation, etc. (don't want to imitate an advertisement) ? MATLAB does provide a way.

When you install MATLAB, a COM file is registered on the machine running the installation that can enable one to use it and 'interface' a language to MATLAB to communicate between the two languages, pass commands and results. For the sake of our discussion, we'll be using Visual Basic 2010. (Many other languages can serve this purpose). The name isn't important - it's title will suffice.

 

Here is the procedure.

After creating a new project, right-click on the project in the solution explorer, and select 'Add Reference'.

Right-Click Menu

 

After that, a dialog box will appear. Select 'MATLAB Application Type Library'

Add Reference Dialog

 

You're Done !!!

So Easy. Isn't It???

 

Now, all you need to do is to type some code.

Create a new object titled xyz of type 'MLApp.MLApp'. Now you can type xyz. and VIsual Studio's Intellisense wil show you a list of commands. The 'Execute' function is the one that will be used  Pass a string, e.g. '1 +1' or 'tan(45)' and it will return a string.

Tip : use the MATLAB's 'disp' command to get rid of that ugly "ANS = " text

User reviews

There are no user reviews for this listing.

To write a review please register or login.
 
 
 
Written by :
Muhammad Maiz Ghauri
 
 






Latest Content
User rating
 
0.0 (0)