kyamagu / mexplus

C++ Matlab MEX development kit.
Other
99 stars 49 forks source link

Representing multi-dimensional arrays #18

Closed patrikhuber closed 7 years ago

patrikhuber commented 7 years ago

Hi!

Do I see that correctly that currently, MxArray doesn't support multi-dimensional arrays? My use case is that I want to return a m x n x 3 numeric matrix from C++ to Matlab (more specifically, a 3-channel image). I think what's needed is adding functionality that calls mxCreateNumericArray to MxArray. For example, I'd start by adding a constructor

template <typename T>
static mxArray* Array(int ndims, std::vector<int> dims);

If that's all correct, I would go ahead and implement it, and if it goes well, I'm very happy to submit a PR?

Thanks!