comparison examples/code/mypow2.c @ 20472:5c42ff6f0eb1 stable

Clean up MEX example code. * myfeval.c: Use mxIsChar rather than deprecated mxIsString. * mypow2.c: Validate that input is a double matrix. * myprop.c: Use space after '!' operator to conform to Octave conventions. * myset.c: Use mexPutVariable instead of missing mxSetName and deprecated mexPutArray. Find existing variable EITHER in global workspace OR in caller workspace. Don't check both. * mystruct.c: Clarify input validation message.
author Rik <rik@octave.org>
date Mon, 15 Jun 2015 10:24:13 -0700
parents c8240a60dd01
children
comparison
equal deleted inserted replaced
20471:2691947f5409 20472:5c42ff6f0eb1
6 { 6 {
7 mwSize n; 7 mwSize n;
8 mwIndex i; 8 mwIndex i;
9 double *vri, *vro; 9 double *vri, *vro;
10 10
11 if (nrhs != 1 || ! mxIsNumeric (prhs[0])) 11 if (nrhs != 1 || ! mxIsDouble (prhs[0]))
12 mexErrMsgTxt ("ARG1 must be a matrix"); 12 mexErrMsgTxt ("ARG1 must be a double matrix");
13 13
14 n = mxGetNumberOfElements (prhs[0]); 14 n = mxGetNumberOfElements (prhs[0]);
15 plhs[0] = mxCreateNumericArray (mxGetNumberOfDimensions (prhs[0]), 15 plhs[0] = mxCreateNumericArray (mxGetNumberOfDimensions (prhs[0]),
16 mxGetDimensions (prhs[0]), 16 mxGetDimensions (prhs[0]),
17 mxGetClassID (prhs[0]), 17 mxGetClassID (prhs[0]),