📄 structcombine.c
字号:
/*
* MATLAB Compiler: 3.0
* Date: Tue May 18 17:08:40 2004
* 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" "-B" "sgl" "-m" "-W"
* "main" "-L" "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "-W" "mainhg"
* "libmwsglm.mlib" "structcombine.m"
*/
#include "structcombine.h"
#include "libmatlbm.h"
void InitializeModule_structcombine(void) {
}
void TerminateModule_structcombine(void) {
}
static mxArray * Mstructcombine(int nargout_,
mxArray * structIn1,
mxArray * structIn2,
mxArray * name1,
mxArray * name2);
_mexLocalFunctionTable _local_function_table_structcombine
= { 0, (mexFunctionTableEntry *)NULL };
/*
* The function "mlfStructcombine" contains the normal interface for the
* "structcombine" M-function from file
* "d:\matlab6p5p1\work\book\dataconversion\mfiles\structcombine.m" (lines
* 1-5). This function processes any input arguments and passes them to the
* implementation version of the function, appearing above.
*/
mxArray * mlfStructcombine(mxArray * structIn1,
mxArray * structIn2,
mxArray * name1,
mxArray * name2) {
int nargout = 1;
mxArray * structOut = NULL;
mlfEnterNewContext(0, 4, structIn1, structIn2, name1, name2);
structOut = Mstructcombine(nargout, structIn1, structIn2, name1, name2);
mlfRestorePreviousContext(0, 4, structIn1, structIn2, name1, name2);
return mlfReturnValue(structOut);
}
/*
* The function "mlxStructcombine" contains the feval interface for the
* "structcombine" M-function from file
* "d:\matlab6p5p1\work\book\dataconversion\mfiles\structcombine.m" (lines
* 1-5). The feval function calls the implementation version of structcombine
* through this function. This function processes any input arguments and
* passes them to the implementation version of the function, appearing above.
*/
void mlxStructcombine(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
mxArray * mprhs[4];
mxArray * mplhs[1];
int i;
if (nlhs > 1) {
mlfError(
mxCreateString(
"Run-time Error: File: structcombine Line: 1 Column"
": 1 The function \"structcombine\" was called with"
" more than the declared number of outputs (1)."),
NULL);
}
if (nrhs > 4) {
mlfError(
mxCreateString(
"Run-time Error: File: structcombine Line: 1 Colum"
"n: 1 The function \"structcombine\" was called wi"
"th more than the declared number of inputs (4)."),
NULL);
}
for (i = 0; i < 1; ++i) {
mplhs[i] = NULL;
}
for (i = 0; i < 4 && i < nrhs; ++i) {
mprhs[i] = prhs[i];
}
for (; i < 4; ++i) {
mprhs[i] = NULL;
}
mlfEnterNewContext(0, 4, mprhs[0], mprhs[1], mprhs[2], mprhs[3]);
mplhs[0] = Mstructcombine(nlhs, mprhs[0], mprhs[1], mprhs[2], mprhs[3]);
mlfRestorePreviousContext(0, 4, mprhs[0], mprhs[1], mprhs[2], mprhs[3]);
plhs[0] = mplhs[0];
}
/*
* The function "Mstructcombine" is the implementation version of the
* "structcombine" M-function from file
* "d:\matlab6p5p1\work\book\dataconversion\mfiles\structcombine.m" (lines
* 1-5). 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 [structOut]=structcombine(structIn1,structIn2,name1,name2)
*/
static mxArray * Mstructcombine(int nargout_,
mxArray * structIn1,
mxArray * structIn2,
mxArray * name1,
mxArray * name2) {
mexLocalFunctionTable save_local_function_table_
= mclSetCurrentLocalFunctionTable(&_local_function_table_structcombine);
mxArray * structOut = NULL;
mclCopyArray(&structIn1);
mclCopyArray(&structIn2);
mclCopyArray(&name1);
mclCopyArray(&name2);
/*
* %function [structOut]=structcombine(structIn1,structIn2,name1,name2)
* %结构体输入输出类型转换
* %将输入的两个结构体重新组合成新的结构体
* structOut=struct(name1,structIn1,name2,structIn2);
*/
mlfAssign(
&structOut,
mlfStruct(
mclVa(name1, "name1"),
mclVa(structIn1, "structIn1"),
mclVa(name2, "name2"),
mclVa(structIn2, "structIn2"),
NULL));
mclValidateOutput(structOut, 1, nargout_, "structOut", "structcombine");
mxDestroyArray(name2);
mxDestroyArray(name1);
mxDestroyArray(structIn2);
mxDestroyArray(structIn1);
mclSetCurrentLocalFunctionTable(save_local_function_table_);
return structOut;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -