Interfacing MATLAB and VIsual Basic 2010
![]() |
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'.

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

Â
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
To write a review please register or login.
|
Category: TB-Reviews
|
|
Category: TB-Articles
|
|
Category: TB-Blog
|
|
Category: TB-Blog
|
|
Category: TB-Blog
|
|
Category: TB-Blog
|
|
Category: TB-Blog
|
|
Category: TB-Reviews
|
|
Category: TB-Reviews
|
|
Category: TB-Reviews
|
|
Category: TB-Reviews
|
|
Category: TB-Reviews
|
|
Category: TB-Reviews
|
|
Category: TB-Reviews
|
|
Category: TB-Reviews
|
|
Category: TB-Reviews
|
|
Category: TB-Blog
|
|
Category: TB-Blog
|





