9 #ifndef mrpt_math_utils_matlab_H 10 #define mrpt_math_utils_matlab_H 16 #include <mrpt/config.h> 37 template <
typename Derived>
40 const size_t m = mat.rows(),
n = mat.cols();
41 mxArray* mxa = mxCreateDoubleMatrix(m,
n, mxREAL);
42 double* mxa_data = mxGetPr(
44 for (
size_t j = 0; j <
n; j++)
45 for (
size_t i = 0; i < m; i++)
46 *mxa_data++ = mat.derived().coeff(i, j);
52 template <
typename CONTAINER>
55 const size_t m = vec.size(),
n = 1;
56 mxArray* mxa = mxCreateDoubleMatrix(m,
n, mxREAL);
57 double* mxa_data = mxGetPr(
59 for (
size_t i = 0; i < m; i++)
mxArray * convertToMatlab(const Eigen::EigenBase< Derived > &mat)
Convert vectors, arrays and matrices into Matlab vectors/matrices.
mxArray * convertVectorToMatlab(const CONTAINER &vec)
Convert std::vector<> or std::deque<> of numeric types into Matlab vectors.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
struct mxArray_tag mxArray
Forward declaration for mxArray (avoid #including as much as possible to speed up compiling) ...