DREAM Suite plugin modules can also be implemented in MATLAB script files (*.m). To prepare such a plugin, take the following steps:
- On the Model Definition page, select plugin type MATLAB COM or MATLAB Engine. MATLAB COM interface is more general in terms of combining 32-bit/64-bit program versions, i.e. you can then use 64-bit MATLAB with 32-bit DREAM Suite, which is not possible with the MATLAB Engine interface (64-bit MATLAB requires 64-bit DREAM Suite). On the other hand, the MATLAB Engine interface is a bit faster than MATLAB COM (but still significantly slower than C/C++ plugins).
Figure 5.3.2. MATLAB Plugin Type
- Create two *.m files named according to the project name in the Src_Matlab subdirectory. The first file (e.g. Example01.m) should contain definitions of DREAM parameters and the second file (Example01_Evaluate.m) contains the function for evaluations of proposals. Names of DREAM parameters are identical with names described in the DREAM Suite technical manual or in the manual for MATLAB Implementation of DREAM (J.Vrugt).
Figure 5.3.3. MATLAB files
Figure 5.3.4. MATLAB file with DREAM Parameters
Figure 5.3.5. MATLAB file with the evaluation function
Remarks on using the MATLAB interface
- When using the MATLAB interface in DREAM Suite, you need to have MATLAB installed and activated on your computer.
- Demo examples using the MATLAB interface can be found in library D2 in the Library Manager.
- All demo examples in library D2 have been tested in MATLAB R2016a, 64-bit version. We cannot guarantee that the interface will work correctly with older version of MATLAB.
- The parallel computing is disabled in the MATLAB interface.
- The MATLAB interface (both COM and Engine) is in general significantly slower that the standard C/C++ plugins.
- The source code of both MATLAB interfaces is available in DREAM SDK (subdirectory Templates/PluginMatlabCom and Templates/PluginMatlabEng)