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

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

#include <MatlabWorkspace.h>

Public Member Functions

 MatlabWorkspace ()
 
 ~MatlabWorkspace ()
 
void clear ()
 Clear names and data of variables in workspace.
 
bool write (const std::string &path) const
 Save current list of variables.
 
bool read (const std::string &path)
 Load list of variables from .mat file.
 
template<typename DerivedM >
MatlabWorkspacesave (const Eigen::PlainObjectBase< DerivedM > &M, const std::string &name)
 Assign data to a variable name in the workspace.
 
template<typename MT >
MatlabWorkspacesave (const Eigen::SparseMatrix< MT > &M, const 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.
 
template<typename ScalarM >
MatlabWorkspacesave (const std::vector< std::vector< ScalarM > > &vM, const 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.
 
template<typename ScalarV >
MatlabWorkspacesave (const std::vector< ScalarV > &vV, const 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.
 
template<typename Q >
MatlabWorkspacesave (const Eigen::Quaternion< Q > &q, const std::string &name)
 
MatlabWorkspacesave (const double d, const 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.
 
template<typename DerivedM >
MatlabWorkspacesave_index (const Eigen::DenseBase< DerivedM > &M, const std::string &name)
 Same as save() but adds 1 to each element, useful for saving "index" matrices like lists of faces or elements.
 
template<typename ScalarM >
MatlabWorkspacesave_index (const std::vector< std::vector< ScalarM > > &vM, const 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.
 
template<typename ScalarV >
MatlabWorkspacesave_index (const std::vector< ScalarV > &vV, const 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.
 
template<typename DerivedM >
bool find (const std::string &name, Eigen::PlainObjectBase< DerivedM > &M)
 Find a certain matrix by name.
 
template<typename MT >
bool find (const std::string &name, Eigen::SparseMatrix< MT > &M)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
bool find (const std::string &name, double &d)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
bool find (const std::string &name, int &v)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename DerivedM >
bool find_index (const std::string &name, Eigen::PlainObjectBase< DerivedM > &M)
 Subtracts 1 from all entries.
 
template<typename DerivedM >
igl::matlab::MatlabWorkspacesave (const Eigen::PlainObjectBase< DerivedM > &M, const std::string &name)
 
template<typename MT >
igl::matlab::MatlabWorkspacesave (const Eigen::SparseMatrix< MT > &M, const std::string &name)
 
template<typename ScalarM >
igl::matlab::MatlabWorkspacesave (const std::vector< std::vector< ScalarM > > &vM, const std::string &name)
 
template<typename ScalarV >
igl::matlab::MatlabWorkspacesave (const std::vector< ScalarV > &vV, const std::string &name)
 
template<typename Q >
igl::matlab::MatlabWorkspacesave (const Eigen::Quaternion< Q > &q, const std::string &name)
 
template<typename DerivedM >
igl::matlab::MatlabWorkspacesave_index (const Eigen::DenseBase< DerivedM > &M, const std::string &name)
 
template<typename ScalarM >
igl::matlab::MatlabWorkspacesave_index (const std::vector< std::vector< ScalarM > > &vM, const std::string &name)
 
template<typename ScalarV >
igl::matlab::MatlabWorkspacesave_index (const std::vector< ScalarV > &vV, const std::string &name)
 

Detailed Description

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

This depends on matlab at compile time (though it shouldn't necessarily have to) but it does not depend on running the matlab engine at run-time.

Constructor & Destructor Documentation

◆ MatlabWorkspace()

igl::matlab::MatlabWorkspace::MatlabWorkspace ( )
inline

◆ ~MatlabWorkspace()

igl::matlab::MatlabWorkspace::~MatlabWorkspace ( )
inline

Member Function Documentation

◆ clear()

void igl::matlab::MatlabWorkspace::clear ( )
inline

Clear names and data of variables in workspace.

◆ write()

bool igl::matlab::MatlabWorkspace::write ( const std::string &  path) const
inline

Save current list of variables.

Parameters
[in]pathpath to .mat file
Returns
true on success, false on failure

◆ read()

bool igl::matlab::MatlabWorkspace::read ( const std::string &  path)
inline

Load list of variables from .mat file.

Parameters
[in]pathpath to .mat file
Returns
true on success, false on failure

◆ save() [1/11]

template<typename DerivedM >
MatlabWorkspace & igl::matlab::MatlabWorkspace::save ( const Eigen::PlainObjectBase< DerivedM > &  M,
const std::string &  name 
)
inline

Assign data to a variable name in the workspace.

Template Parameters
DerivedMeigen matrix (e.g. MatrixXd)
Parameters
[in]Mdata (usually a matrix)
[in]namevariable name to save into work space
Returns
true on success, false on failure

◆ save() [2/11]

template<typename MT >
MatlabWorkspace & igl::matlab::MatlabWorkspace::save ( const Eigen::SparseMatrix< MT > &  M,
const std::string &  name 
)
inline

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

Template Parameters
MTsparse matrix type (e.g. double)

◆ save() [3/11]

template<typename ScalarM >
MatlabWorkspace & igl::matlab::MatlabWorkspace::save ( const std::vector< std::vector< ScalarM > > &  vM,
const std::string &  name 
)
inline

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

Template Parameters
ScalarMscalar type, e.g. double

◆ save() [4/11]

template<typename ScalarV >
MatlabWorkspace & igl::matlab::MatlabWorkspace::save ( const std::vector< ScalarV > &  vV,
const std::string &  name 
)
inline

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

Template Parameters
ScalarVscalar type, e.g. double

◆ save() [5/11]

template<typename Q >
MatlabWorkspace & igl::matlab::MatlabWorkspace::save ( const Eigen::Quaternion< Q > &  q,
const std::string &  name 
)
inline
Template Parameters
Qquaternion type

NOTE: Eigen stores quaternions coefficients as (i,j,k,1), but most of our matlab code stores them as (1,i,j,k) This takes a quaternion and saves it as a (1,i,j,k) row vector

◆ save() [6/11]

igl::matlab::MatlabWorkspace & igl::matlab::MatlabWorkspace::save ( const double  d,
const std::string &  name 
)
inline

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

◆ save_index() [1/6]

template<typename DerivedM >
MatlabWorkspace & igl::matlab::MatlabWorkspace::save_index ( const Eigen::DenseBase< DerivedM > &  M,
const std::string &  name 
)
inline

Same as save() but adds 1 to each element, useful for saving "index" matrices like lists of faces or elements.

Template Parameters
DerivedMeigen matrix (e.g. MatrixXd)

◆ save_index() [2/6]

template<typename ScalarM >
MatlabWorkspace & igl::matlab::MatlabWorkspace::save_index ( const std::vector< std::vector< ScalarM > > &  vM,
const std::string &  name 
)
inline

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

Template Parameters
MTsparse matrix type (e.g. double)

◆ save_index() [3/6]

template<typename ScalarV >
MatlabWorkspace & igl::matlab::MatlabWorkspace::save_index ( const std::vector< ScalarV > &  vV,
const std::string &  name 
)
inline

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

Template Parameters
ScalarVscalar type, e.g. double

◆ find() [1/4]

template<typename DerivedM >
bool igl::matlab::MatlabWorkspace::find ( const std::string &  name,
Eigen::PlainObjectBase< DerivedM > &  M 
)
inline

Find a certain matrix by name.

Template Parameters
DerivedMeigen matrix (e.g. MatrixXd)
Parameters
[in]nameexact name of matrix as string
[out]Mmatrix
Returns
true only if found.

◆ find() [2/4]

template<typename MT >
bool igl::matlab::MatlabWorkspace::find ( const std::string &  name,
Eigen::SparseMatrix< MT > &  M 
)
inline

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

Template Parameters
MTsparse matrix type (e.g. double)

◆ find() [3/4]

bool igl::matlab::MatlabWorkspace::find ( const std::string &  name,
double &  d 
)
inline

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

◆ find() [4/4]

bool igl::matlab::MatlabWorkspace::find ( const std::string &  name,
int &  v 
)
inline

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

◆ find_index()

template<typename DerivedM >
bool igl::matlab::MatlabWorkspace::find_index ( const std::string &  name,
Eigen::PlainObjectBase< DerivedM > &  M 
)
inline

Subtracts 1 from all entries.

Template Parameters
DerivedMeigen matrix (e.g. MatrixXd)
Parameters
[in]nameexact name of matrix as string
[out]Mmatrix

◆ save() [7/11]

template<typename DerivedM >
igl::matlab::MatlabWorkspace & igl::matlab::MatlabWorkspace::save ( const Eigen::PlainObjectBase< DerivedM > &  M,
const std::string &  name 
)
inline

◆ save() [8/11]

template<typename MT >
igl::matlab::MatlabWorkspace & igl::matlab::MatlabWorkspace::save ( const Eigen::SparseMatrix< MT > &  M,
const std::string &  name 
)
inline

◆ save() [9/11]

template<typename ScalarM >
igl::matlab::MatlabWorkspace & igl::matlab::MatlabWorkspace::save ( const std::vector< std::vector< ScalarM > > &  vM,
const std::string &  name 
)
inline

◆ save() [10/11]

template<typename ScalarV >
igl::matlab::MatlabWorkspace & igl::matlab::MatlabWorkspace::save ( const std::vector< ScalarV > &  vV,
const std::string &  name 
)
inline

◆ save() [11/11]

template<typename Q >
igl::matlab::MatlabWorkspace & igl::matlab::MatlabWorkspace::save ( const Eigen::Quaternion< Q > &  q,
const std::string &  name 
)
inline

◆ save_index() [4/6]

template<typename DerivedM >
igl::matlab::MatlabWorkspace & igl::matlab::MatlabWorkspace::save_index ( const Eigen::DenseBase< DerivedM > &  M,
const std::string &  name 
)
inline

◆ save_index() [5/6]

template<typename ScalarM >
igl::matlab::MatlabWorkspace & igl::matlab::MatlabWorkspace::save_index ( const std::vector< std::vector< ScalarM > > &  vM,
const std::string &  name 
)
inline

◆ save_index() [6/6]

template<typename ScalarV >
igl::matlab::MatlabWorkspace & igl::matlab::MatlabWorkspace::save_index ( const std::vector< ScalarV > &  vV,
const std::string &  name 
)
inline

The documentation for this class was generated from the following file: