Debian Codegraph @

Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp

raw
1
2 // simple workaround to some compiler specific problems
3 // see
4 // http://stackoverflow.com/questions/22367516/mex-compile-error-unknown-type-name-char16-t/23281916#23281916
5 #include <algorithm>
6
7 #include "mex.h"
8
9 // this test should return a matrix of 10 x 10 and should check some of the
10 // arguments
11
12 void mexFunction(int const nlhs, mxArray* plhs[], int const nrhs,
13 mxArray const* prhs[])
14 {
15 if (nrhs != 1) {
16 mexErrMsgTxt("Incorrect arguments");
17 }
18
19 size_t dim1 = mxGetM(prhs[0]);
20 size_t dim2 = mxGetN(prhs[0]);
21
22 if (dim1 == 1 || dim2 == 1) {
23 mexErrMsgIdAndTxt("cmake_matlab:configuration", "Incorrect arguments");
24 }
25
26 plhs[0] = mxCreateNumericMatrix(dim1, dim2, mxGetClassID(prhs[0]), mxREAL);
27 }