15 #include <mrpt/config.h> 34 template <
typename Derived>
37 const size_t m = mat.rows(),
n = mat.cols();
38 mxArray* mxa = mxCreateDoubleMatrix(m,
n, mxREAL);
39 double* mxa_data = mxGetPr(
41 for (
size_t j = 0; j <
n; j++)
42 for (
size_t i = 0; i < m; i++)
43 *mxa_data++ = mat.derived().coeff(i, j);
49 template <
typename CONTAINER>
52 const size_t m = vec.size(),
n = 1;
53 mxArray* mxa = mxCreateDoubleMatrix(m,
n, mxREAL);
54 double* mxa_data = mxGetPr(
56 for (
size_t i = 0; i < m; i++)
mxArray * convertToMatlab(const Eigen::EigenBase< Derived > &mat)
Convert vectors, arrays and matrices into Matlab vectors/matrices.
This base provides a set of functions for maths stuff.
mxArray * convertVectorToMatlab(const CONTAINER &vec)
Convert std::vector<> or std::deque<> of numeric types into Matlab vectors.
struct mxArray_tag mxArray
Forward declaration for mxArray (avoid #including as much as possible to speed up compiling) ...