Description
Class for accessing the Matlab engine.
A ChMatlabEngine allows variables to be copied from/to Chrono and Matlab command executed.
#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... | |
bool | GetString (std::string &str, std::string varname) |
Fetch a string from Matlab environment, specifying its name as variable. | |
void | KeepEngineOpen (bool open) |
Keep matlab engine open even after termination of C++ program. More... | |
virtual void | ArchiveOut (ChArchiveOut &archive_out) |
Method to allow serialization of transient data from archives. | |
virtual void | ArchiveIn (ChArchiveIn &archive_in) |
Method to allow de-serialization of transient data from archives. | |
Member Function Documentation
◆ 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.
◆ KeepEngineOpen()
void chrono::ChMatlabEngine::KeepEngineOpen | ( | bool | open | ) |
Keep matlab engine open even after termination of C++ program.
Useful to skip initial time to reload engine (NB: thus, it must be closed manually).
◆ 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