if true
/*
* NormalCalc.c - calculates normals of point cloud
*
*
* points: a 3xN matrix (inMatrix)
* normals: outputs a 3xN matrix (outMatrix)
*
* The calling syntax is:
*
* outMatrix = arrayProduct(multiplier, inMatrix)
*
* This is a MEX-file for MATLAB.
*/
#include "mex.h"
#include <pcl/features/feature.h>
//typedef pcl::PointXYZRGBA PointT;
//typedef pcl::PointCloud<PointT> PointCloud;
/* The computational routine */
void NormalCalc(float *points, double *normals,int npoints){
mwSize i;
for (i=0; i<3*npoints; i++) {
normals[i]=(double) points[i];
mexPrintf("%f\n",points[i]);
}
}
/* The gateway function */
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
/* variable declarations here */
float *inMatrix; /* 3xN input matrix */
mwSize npoints; /* size of matrix */
double *outMatrix; /* output matrix */
/* code here */
/* check for proper number of arguments */
if(nrhs!=1) {
mexErrMsgIdAndTxt("MyToolbox:arrayProduct:nrhs",
"one inputs required.");
}
if(nlhs!=1) {
mexErrMsgIdAndTxt("MyToolbox:arrayProduct:nlhs",
"One output required.");
}
/* check that number of rows in points input argument is 3 */
if(mxGetM(prhs[0])!=3) {
mexErrMsgIdAndTxt("MyToolbox:arrayProduct:notRowVector",
"Input must be a 3 row vector.");
}
/* create a pointer to the real data in the input matrix */
inMatrix = mxGetPr(prhs[0]);
/* get dimensions of the input matrix = number of points */
npoints = mxGetN(prhs[0]);
/* create the output matrix */
plhs[0] = mxCreateDoubleMatrix(3,npoints,mxREAL);
/* get a pointer to the real data in the output matrix */
outMatrix = mxGetPr(plhs[0]);
/* call the computational routine */
NormalCalc(inMatrix, outMatrix,npoints);
}
end
if true
Error using mex
NormalCalc.c
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(19) : error C2054: expected
'(' to follow 'using'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(19) : error C2061: syntax
error : identifier 'using'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(19) : error C2054: expected
'(' to follow 'using'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(21) : error C2061: syntax
error : identifier 'using'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(21) : error C2061: syntax
error : identifier 'abs'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(21) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(21) : error C2061: syntax
error : identifier 'atexit'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(21) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(22) : error C2061: syntax
error : identifier 'atof'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(22) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(22) : error C2061: syntax
error : identifier 'atoi'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(22) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(22) : error C2061: syntax
error : identifier 'atol'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(22) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(23) : error C2061: syntax
error : identifier 'bsearch'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(23) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(23) : error C2061: syntax
error : identifier 'calloc'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(23) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(23) : error C2061: syntax
error : identifier 'div'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(23) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(24) : error C2061: syntax
error : identifier 'exit'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(24) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(24) : error C2061: syntax
error : identifier 'free'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(24) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(24) : error C2061: syntax
error : identifier 'getenv'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(24) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(25) : error C2061: syntax
error : identifier 'labs'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(25) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(25) : error C2061: syntax
error : identifier 'ldiv'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(25) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(25) : error C2061: syntax
error : identifier 'malloc'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(25) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(26) : error C2061: syntax
error : identifier 'mblen'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(26) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(26) : error C2061: syntax
error : identifier 'mbstowcs'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(26) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(26) : error C2061: syntax
error : identifier 'mbtowc'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(26) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(27) : error C2061: syntax
error : identifier 'qsort'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(27) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(27) : error C2061: syntax
error : identifier 'rand'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(27) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(27) : error C2061: syntax
error : identifier 'realloc'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(27) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(28) : error C2061: syntax
error : identifier 'srand'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(28) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(28) : error C2061: syntax
error : identifier 'strtod'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(28) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(28) : error C2061: syntax
error : identifier 'strtol'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(28) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(29) : error C2061: syntax
error : identifier 'strtoul'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(29) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(29) : error C2061: syntax
error : identifier 'system'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(29) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(30) : error C2061: syntax
error : identifier 'wcstombs'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(30) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(30) : error C2061: syntax
error : identifier 'wctomb'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(30) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(32) : error C2054: expected
'(' to follow 'using'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(34) : error C2061: syntax
error : identifier 'using'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(34) : error C2061: syntax
error : identifier 'lldiv'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstdlib(34) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstddef(18) : error C2054: expected
'(' to follow 'using'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\cstddef(18) : error C2061: syntax
error : identifier 'using'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xstddef(78) : error C2143: syntax
error : missing '{' before '<'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xstddef(78) : error C2059: syntax
error : '<'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xstddef(87) : error C2143: syntax
error : missing '{' before '<'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xstddef(87) : error C2059: syntax
error : '<'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xstddef(98) : error C2061: syntax
error : identifier 'tr1'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xstddef(98) : error C2059: syntax
error : ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xstddef(98) : error C2449: found '{'
at file scope (missing function header?)
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xstddef(101) : error C2059: syntax
error : '}'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xstddef(125) : error C2143: syntax
error : missing '{' before ':'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xstddef(125) : error C2059: syntax
error : ':'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xstddef(132) : error C2143: syntax
error : missing '{' before '<'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xstddef(132) : error C2059: syntax
error : '<'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xstddef(141) : error C2143: syntax
error : missing '{' before '<'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xstddef(141) : error C2059: syntax
error : '<'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\eh.h(26) : fatal error C1189: #error :
"eh.h is only for C++!"
end