ChronoEngine:Unit Matlab
From ChronoWiki
unit_MATLAB

This is an optional unit that can expand the features of the Chrono::Engine library. Read the introduction to units for a technical background on the modularity of the Chrono::Engine project.
This is a simple unit that allows exchanging matrices and variables from/to the Matlab environment with simple C++ function calls in Chrono::Engine.
Features
The Matlab unit is used to provide an easy way to call Matlab functions from your Chrono::Engine based application. Basically, you can
 call Matlab commands from your C++ program,
 send/retrieve data to/from Matlab (the Chrono::Engine C++ matrices are converted to Matlab, and viceversa)
 use the Matlab powerful visualization tools, to show simulation data in 2D/3D plots, etc.
Planned, for the future, will be also an easy way to perform SimulinkChrono::Engine cosimulation.
Requirements
 To run applications based on this unit:
 you must have a licensed copy of Matlab(TM) installed on your system. We tested it from the 2006 revision up to the most recent.
 your PATH environment variable must contain the path to the libeng.dll (see below)
 To build applications based on this unit:
 you must have a licensed copy of Matlab(TM) installed on your system. We tested it from the 2006 revision up to the most recent.
Building instructions
Currently this unit (differently from most others) does not correspond to an additional DLL library: it is a simple set of functions included in .h c++ headers. Therefore you do not need to build it.
However, when you build applications that use these headers, you must specify where you have the Matlab API/SDK installed on your system. For example, Matlabbased demos can be built if you enable them in the CMake window.
 Repeat the instructions for the full installation, but when you see the CMake window, you must add the following steps:
 Set the ENABLE_UNIT_MATLAB as 'on', then press 'Configure' (to refresh the variable list)
 Set the CH_MATLAB_SDK to the path where you have your Matlab '/extern' subdirectory. This changes depending on where you installed Matlab. For example, it could be C:/Programmi/MATLAB/R2009b/extern
 Press 'Configure' again, then 'Generate', and proceed as usual in the installation instructions.
When you will rebuild the project, you will find some Matlabbased demos in the binary directory. See the matlab tutorials for informations.
In most cases, when you run an executable that uses the Matlab unit, you will get an error message from Windows, telling that the libeng.dll library cannot be found. This means that you must tell Windows the path where to find it; so you need to modify the PATH system variable. Do the following:
[matlabroot '\bin\win32'] (or [matlabroot '\bin\win64'] on a 64 bit platform). You get the path to the dll on your system.
