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(mxa);
43 for (
size_t j=0;j<
n;j++)
44 for (
size_t i=0;i<m;i++)
45 *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(mxa);
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.
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) ...