00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "mex.h"
00016 #define MAX 1000
00017
00018
00019 void fill( double *pr, mwSize *pm, mwSize *pn, mwSize max )
00020 {
00021 mwSize i;
00022
00023 *pm = max/2;
00024 *pn = 1;
00025 for (i=0; i < (*pm); i++)
00026 pr[i]=i*(4*3.14159/max);
00027 }
00028
00029
00030 void mexFunction( int nlhs, mxArray *plhs[],
00031 int nrhs, const mxArray *prhs[] )
00032 {
00033 mwSize m, n, max=MAX;
00034 mxArray *rhs[1], *lhs[1];
00035
00036 (void) nlhs; (void) plhs;
00037 (void) nrhs; (void) prhs;
00038
00039 rhs[0] = mxCreateDoubleMatrix(max, 1, mxREAL);
00040
00041
00042 fill(mxGetPr(rhs[0]), &m, &n, MAX);
00043 mxSetM(rhs[0], m);
00044 mxSetN(rhs[0], n);
00045
00046
00047
00048 mexCallMATLAB(1, lhs, 1, rhs, "sin");
00049 mexCallMATLAB(0, NULL, 1, lhs, "plot");
00050
00051
00052 mxDestroyArray(rhs[0]);
00053 mxDestroyArray(lhs[0]);
00054
00055 return;
00056 }