chrono::ChMatlabEngine Class Reference

## Description

Class for accessing the Matlab engine with a C++ wrapper.

When a ChMatlabEngine object is instanced, a Matlab engine is started (assuming Matlab is properly installed and its dll are available on the system) and following funcitons can be used to copy variables from/to Chrono, and to execute commands in Matlab. Useful also to exploit the powerful plotting features of Matlab. Note! to compile programs that include this header, your makefile must be properly configured to set the Matlab SDK directory, so that matlab headers and libs can be compiled/linked Also, if you run an executable that used this header on a system that has no Matlab installed, a 'missing dll' error will pop up as soon as you try to start the program.

#include <ChMatlabEngine.h>

## Public Member Functions

matlabengine::Engine * GetEngine ()
Return pointer to internal Matlab engine (avoid using it directly, if you can use other functions of this class that 'wrap' it.)

bool Eval (std::string mstring)
Evaluate a Matlab instruction (as a string). If error happens while executing, returns false.

bool SetVisible (bool mvis)
Set visibility of GUI matlab window.

bool PutVariable (ChMatrixConstRef mmatr, std::string varname)
Put a matrix in Matlab environment, specifying its name as variable. More...

bool PutSparseMatrix (const ChSparseMatrix &mmatr, std::string varname)
Put a sparse matrix in Matlab environment, specifying its name as variable. More...

bool GetVariable (ChMatrixDynamic< double > &mmatr, std::string varname)
Fetch a matrix from Matlab environment, specifying its name as variable. More...

virtual void ArchiveOUT (ChArchiveOut &marchive)

virtual void ArchiveIN (ChArchiveIn &marchive)
Method to allow de serialization of transient data from archives.

## ◆ GetVariable()

 bool chrono::ChMatlabEngine::GetVariable ( ChMatrixDynamic< double > & mmatr, std::string varname )

Fetch a matrix from Matlab environment, specifying its name as variable.

The used matrix must be of ChMatrixDynamic<double> type because it might undergo resizing.

## ◆ PutSparseMatrix()

 bool chrono::ChMatlabEngine::PutSparseMatrix ( const ChSparseMatrix & mmatr, std::string varname )

Put a sparse matrix in Matlab environment, specifying its name as variable.

If a variable with the same name already exist, it is overwritten.

## ◆ PutVariable()

 bool chrono::ChMatlabEngine::PutVariable ( ChMatrixConstRef mmatr, std::string varname )

Put a matrix in Matlab environment, specifying its name as variable.

If a variable with the same name already exist, it is overwritten.

The documentation for this class was generated from the following files:
• /builds/uwsbel/chrono/src/chrono_matlab/ChMatlabEngine.h
• /builds/uwsbel/chrono/src/chrono_matlab/ChMatlabEngine.cpp