📄 mymagic.c
字号:
/*
* MATLAB Compiler: 3.0
* Date: Fri Feb 15 16:15:00 2008
* Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
* "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
* "array_indexing:on" "-O" "optimize_conditionals:on" "-M" "-silentsetup" "-d"
* "D:/precipitation model/20080204/xlmagic/src" "-B"
* "cexcel:xlmagic,xlmagic,1.0" "-t" "-W" "excel:xlmagic,xlmagic,1.0" "-T"
* "link:lib" "-h" "libmmfile.mlib" "-b" "-i" "-b" "-i" "D:/precipitation
* model/20080204/xlmagic/mymagic.m"
*/
#include "mymagic.h"
#include "libmatlbm.h"
#include "libmmfile.h"
void InitializeModule_mymagic(void) {
}
void TerminateModule_mymagic(void) {
}
static mxArray * Mmymagic(int nargout_, mxArray * x);
_mexLocalFunctionTable _local_function_table_mymagic
= { 0, (mexFunctionTableEntry *)NULL };
/*
* The function "mlfMymagic" contains the normal interface for the "mymagic"
* M-function from file "d:\precipitation model\20080204\xlmagic\mymagic.m"
* (lines 1-3). This function processes any input arguments and passes them to
* the implementation version of the function, appearing above.
*/
mxArray * mlfMymagic(mxArray * x) {
int nargout = 1;
mxArray * y = NULL;
mlfEnterNewContext(0, 1, x);
y = Mmymagic(nargout, x);
mlfRestorePreviousContext(0, 1, x);
return mlfReturnValue(y);
}
/*
* The function "mlxMymagic" contains the feval interface for the "mymagic"
* M-function from file "d:\precipitation model\20080204\xlmagic\mymagic.m"
* (lines 1-3). The feval function calls the implementation version of mymagic
* through this function. This function processes any input arguments and
* passes them to the implementation version of the function, appearing above.
*/
void mlxMymagic(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
mxArray * mprhs[1];
mxArray * mplhs[1];
int i;
if (nlhs > 1) {
mlfError(
mxCreateString(
"Run-time Error: File: mymagic Line: 1 Column: "
"1 The function \"mymagic\" was called with mor"
"e than the declared number of outputs (1)."),
NULL);
}
if (nrhs > 1) {
mlfError(
mxCreateString(
"Run-time Error: File: mymagic Line: 1 Column:"
" 1 The function \"mymagic\" was called with m"
"ore than the declared number of inputs (1)."),
NULL);
}
for (i = 0; i < 1; ++i) {
mplhs[i] = NULL;
}
for (i = 0; i < 1 && i < nrhs; ++i) {
mprhs[i] = prhs[i];
}
for (; i < 1; ++i) {
mprhs[i] = NULL;
}
mlfEnterNewContext(0, 1, mprhs[0]);
mplhs[0] = Mmymagic(nlhs, mprhs[0]);
mlfRestorePreviousContext(0, 1, mprhs[0]);
plhs[0] = mplhs[0];
}
/*
* The function "Mmymagic" is the implementation version of the "mymagic"
* M-function from file "d:\precipitation model\20080204\xlmagic\mymagic.m"
* (lines 1-3). It contains the actual compiled code for that M-function. It is
* a static function and must only be called from one of the interface
* functions, appearing below.
*/
/*
* function y=mymagic(x)
*/
static mxArray * Mmymagic(int nargout_, mxArray * x) {
mexLocalFunctionTable save_local_function_table_
= mclSetCurrentLocalFunctionTable(&_local_function_table_mymagic);
mxArray * y = NULL;
mclCopyArray(&x);
/*
* y=magic(x)
*/
mlfAssign(&y, mlfMagic(mclVa(x, "x")));
mclPrintArray(mclVv(y, "y"), "y");
mclValidateOutput(y, 1, nargout_, "y", "mymagic");
mxDestroyArray(x);
mclSetCurrentLocalFunctionTable(save_local_function_table_);
return y;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -