Selasa, 06 Maret 2012

Connecting C++ and Matlab

There are three ways how C++ connect to MATLAB:
  1. sending data from C++ to Matlab
  2. calling a Matlab function from C++
  3. obtaining DLL file (Dynamic Link Library) from m.file
In this time, I will share about the second way (calling an function Matlab from C++).
For this case, I utilize Microsoft Visual Studio 2010 Express win32 and Matlab 2011a win32.
The important things that we need to know in order to connecting C++ and Matlab, are:
1. Setting C++ project:
a. identify Matlab directory for a project:
b. identify link to the MATLAB derectory that contains library for a project:
c. include library file, such as: libeng.lib, libmat.lib, libmx.lib, libmex.lib, dan another function that you need.
2. Setting path of the Microsoft Windows operating system:
 3. Identify the  MATLAB  server. This occurs when the C++ has not been connected with Matlab and fairly done once (instead of each make a new project).
 4. Always don't forget to include header engine.h ( #include <engine.h> )

For detail of the procedure and better understanding this topic, please got to this following link. It describes the complete version and give the simple example.
Connecting c++ to Matlab

Tidak ada komentar:

Posting Komentar