mex

matlab - How to use a struct in a mex file

It took me some time until I figured out how to pass a struct to a mex file and especially how to get out the values.

To get the values from the struct following lines are important:

 /* get the values from the struct */
  const mxArray  *mxTmp; 
  double         *tmp;
 
  mxTmp = mxGetField(prhs[1],0,"par1");
  tmp   = mxGetPr(mxTmp); 

Here the full code