📄 mcctest.cpp
字号:
//
// MATLAB Compiler: 2.1
// Date: Wed Oct 24 01:07:43 2001
// 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" "-p" "-W" "main" "-L"
// "Cpp" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "mcctest.m"
//
#include "mcctest.hpp"
#include "libmatlbm.hpp"
static mxChar _array1_[132] = { 'R', 'u', 'n', '-', 't', 'i', 'm', 'e', ' ',
'E', 'r', 'r', 'o', 'r', ':', ' ', 'F', 'i',
'l', 'e', ':', ' ', 'm', 'c', 'c', 't', 'e',
's', 't', ' ', 'L', 'i', 'n', 'e', ':', ' ',
'1', ' ', 'C', 'o', 'l', 'u', 'm', 'n', ':',
' ', '1', ' ', 'T', 'h', 'e', ' ', 'f', 'u',
'n', 'c', 't', 'i', 'o', 'n', ' ', '"', 'm',
'c', 'c', 't', 'e', 's', 't', '"', ' ', 'w',
'a', 's', ' ', 'c', 'a', 'l', 'l', 'e', 'd',
' ', 'w', 'i', 't', 'h', ' ', 'm', 'o', 'r',
'e', ' ', 't', 'h', 'a', 'n', ' ', 't', 'h',
'e', ' ', 'd', 'e', 'c', 'l', 'a', 'r', 'e',
'd', ' ', 'n', 'u', 'm', 'b', 'e', 'r', ' ',
'o', 'f', ' ', 'o', 'u', 't', 'p', 'u', 't',
's', ' ', '(', '0', ')', '.' };
static mwArray _mxarray0_ = mclInitializeString(132, _array1_);
static mxChar _array3_[131] = { 'R', 'u', 'n', '-', 't', 'i', 'm', 'e', ' ',
'E', 'r', 'r', 'o', 'r', ':', ' ', 'F', 'i',
'l', 'e', ':', ' ', 'm', 'c', 'c', 't', 'e',
's', 't', ' ', 'L', 'i', 'n', 'e', ':', ' ',
'1', ' ', 'C', 'o', 'l', 'u', 'm', 'n', ':',
' ', '1', ' ', 'T', 'h', 'e', ' ', 'f', 'u',
'n', 'c', 't', 'i', 'o', 'n', ' ', '"', 'm',
'c', 'c', 't', 'e', 's', 't', '"', ' ', 'w',
'a', 's', ' ', 'c', 'a', 'l', 'l', 'e', 'd',
' ', 'w', 'i', 't', 'h', ' ', 'm', 'o', 'r',
'e', ' ', 't', 'h', 'a', 'n', ' ', 't', 'h',
'e', ' ', 'd', 'e', 'c', 'l', 'a', 'r', 'e',
'd', ' ', 'n', 'u', 'm', 'b', 'e', 'r', ' ',
'o', 'f', ' ', 'i', 'n', 'p', 'u', 't', 's',
' ', '(', '0', ')', '.' };
static mwArray _mxarray2_ = mclInitializeString(131, _array3_);
static mwArray _mxarray4_ = mclInitializeDouble(256.0);
static mwArray _mxarray5_ = mclInitializeDouble(1.0);
static mwArray _mxarray6_ = mclInitializeDouble(50.26548245743669);
static mwArray _mxarray7_ = mclInitializeDouble(2.0);
static mxChar _array9_[22] = { 'M', 'a', 'x', ' ', '=', ' ', '%', 'd',
',', ' ', 'I', 'n', 'd', 'e', 'x', ' ',
'=', ' ', '%', 'd', 0x005c, 'n' };
static mwArray _mxarray8_ = mclInitializeString(22, _array9_);
void InitializeModule_mcctest() {
}
void TerminateModule_mcctest() {
}
static void Mmcctest();
_mexLocalFunctionTable _local_function_table_mcctest
= { 0, (mexFunctionTableEntry *)NULL };
//
// The function "mcctest" contains the normal interface for the "mcctest"
// M-function from file "d:\book\soft\ch9\mcctest.m" (lines 1-8). This function
// processes any input arguments and passes them to the implementation version
// of the function, appearing above.
//
void mcctest() {
Mmcctest();
}
//
// The function "mlxMcctest" contains the feval interface for the "mcctest"
// M-function from file "d:\book\soft\ch9\mcctest.m" (lines 1-8). The feval
// function calls the implementation version of mcctest through this function.
// This function processes any input arguments and passes them to the
// implementation version of the function, appearing above.
//
void mlxMcctest(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
MW_BEGIN_MLX();
{
if (nlhs > 0) {
error(_mxarray0_);
}
if (nrhs > 0) {
error(_mxarray2_);
}
Mmcctest();
}
MW_END_MLX();
}
//
// The function "Mmcctest" is the implementation version of the "mcctest"
// M-function from file "d:\book\soft\ch9\mcctest.m" (lines 1-8). 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 mcctest()
//
static void Mmcctest() {
mwLocalFunctionTable save_local_function_table_(&_local_function_table_mcctest);
mwArray ans(mclGetUninitializedArray());
mwArray i(mclGetUninitializedArray());
mwArray m(mclGetUninitializedArray());
mwArray y(mclGetUninitializedArray());
mwArray x(mclGetUninitializedArray());
mwArray n(mclGetUninitializedArray());
//
//
// n = 256;
//
n = _mxarray4_;
//
// x = sin([1:n]/n*(16*pi));
//
x = sin(colon(_mxarray5_, mwVv(n, "n")) / mwVv(n, "n") * _mxarray6_);
//
// y = abs(fft(x));
//
y = abs(mwVe(fft(mwVv(x, "x"))));
//
// y = y(1:n/2);
//
y
= mclArrayRef(
mwVsv(y, "y"), colon(_mxarray5_, mwVv(n, "n") / _mxarray7_));
//
// [m i] = max(y);
//
m = max(&i, mwVv(y, "y"));
//
// fprintf('Max = %d, Index = %d\n', m, i);
//
ans.EqAns(Nfprintf(0, _mxarray8_, mwVarargin(mwVv(m, "m"), mwVv(i, "i"))));
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -