CMake/Tests/FindMatlab/matlab_wrapper1.cpp
Raffi Enficiaud 49c8dcf7bb FindMatlab: Rewrite module and provide a usage API
Implement a brand new FindMatlab module:

- Add support for versions and components.
- Find Matlab and its version in a more precise and multiplatform way.
- Add API to create a new mex extension with documentation.
- Add API to add matlab unit tests (with or without the unit test framework).
- Find as much as possible based on a single Matlab_ROOT_DIR cache entry
  and allow the user to change it to re-find everything.
2015-03-17 09:47:04 -04:00

27 lines
716 B
C++

// simple workaround to some compiler specific problems
// see http://stackoverflow.com/questions/22367516/mex-compile-error-unknown-type-name-char16-t/23281916#23281916
#include <algorithm>
#include "mex.h"
// this test should return a matrix of 10 x 10 and should check some of the arguments
void mexFunction(const int nlhs, mxArray *plhs[], const int nrhs, const mxArray *prhs[])
{
if(nrhs != 1)
{
mexErrMsgTxt("Incorrect arguments");
}
size_t dim1 = mxGetM(prhs[0]);
size_t dim2 = mxGetN(prhs[0]);
if(dim1 == 1 || dim2 == 1)
{
mexErrMsgIdAndTxt("cmake_matlab:configuration", "Incorrect arguments");
}
plhs[0] = mxCreateNumericMatrix(dim1, dim2, mxGetClassID(prhs[0]), mxREAL);
}