9 #ifndef mrpt_math_utils_matlab_H 10 #define mrpt_math_utils_matlab_H 16 #include <mrpt/config.h> 35 template <
typename Derived>
38 const size_t m = mat.rows(),
n = mat.cols();
39 mxArray* mxa = mxCreateDoubleMatrix(m,
n, mxREAL);
40 double* mxa_data = mxGetPr(
42 for (
size_t j = 0; j <
n; j++)
43 for (
size_t i = 0; i < m; i++)
44 *mxa_data++ = mat.derived().coeff(i, j);
50 template <
typename CONTAINER>
53 const size_t m = vec.size(),
n = 1;
54 mxArray* mxa = mxCreateDoubleMatrix(m,
n, mxREAL);
55 double* mxa_data = mxGetPr(
57 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) ...