libigl v2.5.0
Loading...
Searching...
No Matches
igl::matlab Namespace Reference

Classes

class  MatlabWorkspace
 Class which contains data of a matlab workspace which can be written to a .mat file and loaded from matlab. More...

Functions

void mlinit (Engine **engine)
 Init the MATLAB engine (no need to call it directly since it is automatically invoked by any other command).
void mlclose (Engine **engine)
 Closes the MATLAB engine.
void mlsetmatrix (Engine **engine, std::string name, const Eigen::MatrixXd &M)
 Send a matrix to MATLAB.
void mlsetmatrix (Engine **engine, std::string name, const Eigen::MatrixXf &M)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void mlsetmatrix (Engine **engine, std::string name, const Eigen::MatrixXi &M)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void mlsetmatrix (Engine **mlengine, std::string name, const Eigen::Matrix< unsigned int, Eigen::Dynamic, Eigen::Dynamic > &M)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void mlsetmatrix (Engine **mlengine, std::string name, const Eigen::SparseMatrix< double > &M)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void mlgetmatrix (Engine **engine, std::string name, Eigen::MatrixXd &M)
 Receive a matrix from MATLAB.
void mlgetmatrix (Engine **engine, std::string name, Eigen::MatrixXf &M)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void mlgetmatrix (Engine **engine, std::string name, Eigen::MatrixXi &M)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void mlgetmatrix (Engine **mlengine, std::string name, Eigen::Matrix< unsigned int, Eigen::Dynamic, Eigen::Dynamic > &M)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void mlsetscalar (Engine **engine, std::string name, double s)
 Send a single scalar to MATLAB.
double mlgetscalar (Engine **engine, std::string name)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
std::string mleval (Engine **engine, std::string code)
 Execute arbitrary MATLAB code and return the MATLAB output.
void mexErrMsgTxt (bool test, const char *message)
 Wrapper for mexErrMsgTxt that only calls error if test fails.
template<typename DerivedV>
void parse_rhs_double (const mxArray *prhs[], Eigen::PlainObjectBase< DerivedV > &V)
 Reads in a matrix as a double.
template<typename VType>
void parse_rhs (const mxArray *prhs[], Eigen::SparseMatrix< VType > &M)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<typename DerivedV>
void parse_rhs_index (const mxArray *prhs[], Eigen::PlainObjectBase< DerivedV > &V)
 Reads in a matrix and subtracts 1.
template<typename DerivedV>
void prepare_lhs_double (const Eigen::DenseBase< DerivedV > &V, mxArray *plhs[])
 Writes out a matrix as a double.
template<typename Vtype>
void prepare_lhs_double (const Eigen::SparseMatrix< Vtype > &V, mxArray *plhs[])
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<typename DerivedV>
void prepare_lhs_logical (const Eigen::DenseBase< DerivedV > &V, mxArray *plhs[])
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<typename DerivedV>
void prepare_lhs_index (const Eigen::DenseBase< DerivedV > &V, mxArray *plhs[])
 Writes out a matrix and adds 1.
template<typename Vtype>
void prepare_lhs_double (const std::vector< Vtype > &V, mxArray *plhs[])
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void requires_arg (const int i, const int nrhs, const char *name)
 Simply throw an error if (i+1)<rhs.
void validate_arg_scalar (const int i, const int nrhs, const mxArray *prhs[], const char *name)
 Throw an error if arg i+1 is not a scalar.
void validate_arg_logical (const int i, const int nrhs, const mxArray *prhs[], const char *name)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. \breif Throw an error if arg i+1 is not logical.
void validate_arg_char (const int i, const int nrhs, const mxArray *prhs[], const char *name)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. \breif Throw an error if arg i+1 is not char.
void validate_arg_double (const int i, const int nrhs, const mxArray *prhs[], const char *name)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. \breif Throw an error if arg i+1 is not double.
void validate_arg_function_handle (const int i, const int nrhs, const mxArray *prhs[], const char *name)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. \breif Throw an error if arg i+1 is not a function handle.

Function Documentation

◆ mlinit()

void igl::matlab::mlinit ( Engine ** engine)

Init the MATLAB engine (no need to call it directly since it is automatically invoked by any other command).

Parameters
[in,out]enginepointer to the MATLAB engine

◆ mlclose()

void igl::matlab::mlclose ( Engine ** engine)

Closes the MATLAB engine.

Parameters
[in,out]enginepointer to the MATLAB engine

◆ mlsetmatrix() [1/5]

void igl::matlab::mlsetmatrix ( Engine ** engine,
std::string name,
const Eigen::MatrixXd & M )

Send a matrix to MATLAB.

Parameters
[in,out]enginepointer to the MATLAB engine
[in]namename of the variable in MATLAB
[in]Mmatrix to be sent

◆ mlsetmatrix() [2/5]

void igl::matlab::mlsetmatrix ( Engine ** engine,
std::string name,
const Eigen::MatrixXf & M )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ mlsetmatrix() [3/5]

void igl::matlab::mlsetmatrix ( Engine ** engine,
std::string name,
const Eigen::MatrixXi & M )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ mlsetmatrix() [4/5]

void igl::matlab::mlsetmatrix ( Engine ** mlengine,
std::string name,
const Eigen::Matrix< unsigned int, Eigen::Dynamic, Eigen::Dynamic > & M )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ mlsetmatrix() [5/5]

void igl::matlab::mlsetmatrix ( Engine ** mlengine,
std::string name,
const Eigen::SparseMatrix< double > & M )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ mlgetmatrix() [1/4]

void igl::matlab::mlgetmatrix ( Engine ** engine,
std::string name,
Eigen::MatrixXd & M )

Receive a matrix from MATLAB.

Parameters
[in,out]enginepointer to the MATLAB engine
[in]namename of the variable in MATLAB
[out]Mmatrix received

◆ mlgetmatrix() [2/4]

void igl::matlab::mlgetmatrix ( Engine ** engine,
std::string name,
Eigen::MatrixXf & M )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ mlgetmatrix() [3/4]

void igl::matlab::mlgetmatrix ( Engine ** engine,
std::string name,
Eigen::MatrixXi & M )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ mlgetmatrix() [4/4]

void igl::matlab::mlgetmatrix ( Engine ** mlengine,
std::string name,
Eigen::Matrix< unsigned int, Eigen::Dynamic, Eigen::Dynamic > & M )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ mlsetscalar()

void igl::matlab::mlsetscalar ( Engine ** engine,
std::string name,
double s )

Send a single scalar to MATLAB.

Parameters
[in,out]enginepointer to the MATLAB engine
[in]namename of the variable in MATLAB
[in]Mvalue to be sent

◆ mlgetscalar()

double igl::matlab::mlgetscalar ( Engine ** engine,
std::string name )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ mleval()

std::string igl::matlab::mleval ( Engine ** engine,
std::string code )

Execute arbitrary MATLAB code and return the MATLAB output.

Parameters
[in,out]enginepointer to the MATLAB engine
[in]codeMATLAB code to be executed
Returns
output of the MATLAB code

◆ mexErrMsgTxt()

void igl::matlab::mexErrMsgTxt ( bool test,
const char * message )

Wrapper for mexErrMsgTxt that only calls error if test fails.

Parameters
[in]testboolean expression to test
[in]messagemessage to print if test fails

◆ parse_rhs_double()

template<typename DerivedV>
void igl::matlab::parse_rhs_double ( const mxArray * prhs[],
Eigen::PlainObjectBase< DerivedV > & V )

Reads in a matrix as a double.

Parameters
[in]prhspoints to rhs argument
[out]VM by N matrix

◆ parse_rhs()

template<typename VType>
void igl::matlab::parse_rhs ( const mxArray * prhs[],
Eigen::SparseMatrix< VType > & M )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ parse_rhs_index()

template<typename DerivedV>
void igl::matlab::parse_rhs_index ( const mxArray * prhs[],
Eigen::PlainObjectBase< DerivedV > & V )

Reads in a matrix and subtracts 1.

Parameters
[in]prhspoints to rhs argument
[out]VM by N matrix

◆ prepare_lhs_double() [1/3]

template<typename DerivedV>
void igl::matlab::prepare_lhs_double ( const Eigen::DenseBase< DerivedV > & V,
mxArray * plhs[] )

Writes out a matrix as a double.

Parameters
[in]VM by N matrix
[out]plhspoints to lhs argument

◆ prepare_lhs_double() [2/3]

template<typename Vtype>
void igl::matlab::prepare_lhs_double ( const Eigen::SparseMatrix< Vtype > & V,
mxArray * plhs[] )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ prepare_lhs_logical()

template<typename DerivedV>
void igl::matlab::prepare_lhs_logical ( const Eigen::DenseBase< DerivedV > & V,
mxArray * plhs[] )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Casts to logical

◆ prepare_lhs_index()

template<typename DerivedV>
void igl::matlab::prepare_lhs_index ( const Eigen::DenseBase< DerivedV > & V,
mxArray * plhs[] )

Writes out a matrix and adds 1.

Parameters
[in]VM by N matrix
[out]plhspoints to lhs argument

◆ prepare_lhs_double() [3/3]

template<typename Vtype>
void igl::matlab::prepare_lhs_double ( const std::vector< Vtype > & V,
mxArray * plhs[] )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Vector of matrices -> cell array of matrices

Parameters
[in]Vvector of M by N matrices

◆ requires_arg()

void igl::matlab::requires_arg ( const int i,
const int nrhs,
const char * name )

Simply throw an error if (i+1)<rhs.

Parameters
[in]iindex of current arg
[in]nrhstotal number of args
[in]nameof current arg

◆ validate_arg_scalar()

void igl::matlab::validate_arg_scalar ( const int i,
const int nrhs,
const mxArray * prhs[],
const char * name )

Throw an error if arg i+1 is not a scalar.

Parameters
[in]iindex of current argument
[in]nrhstotal number of arguments
[in]prhspointer to arguments array
[in]namename of current argument

◆ validate_arg_logical()

void igl::matlab::validate_arg_logical ( const int i,
const int nrhs,
const mxArray * prhs[],
const char * name )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. \breif Throw an error if arg i+1 is not logical.

◆ validate_arg_char()

void igl::matlab::validate_arg_char ( const int i,
const int nrhs,
const mxArray * prhs[],
const char * name )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. \breif Throw an error if arg i+1 is not char.

◆ validate_arg_double()

void igl::matlab::validate_arg_double ( const int i,
const int nrhs,
const mxArray * prhs[],
const char * name )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. \breif Throw an error if arg i+1 is not double.

◆ validate_arg_function_handle()

void igl::matlab::validate_arg_function_handle ( const int i,
const int nrhs,
const mxArray * prhs[],
const char * name )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. \breif Throw an error if arg i+1 is not a function handle.