⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exm3.cpp

📁 《精通Matlab6.5版》张志勇等编著
💻 CPP
字号:
//
// MATLAB Compiler: 2.2
// Date: Tue Jun 25 10:44:12 2002
// 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" "-t" "-L" "Cpp" "-A"
// "annotation:comments" "exm3" 
//
#include "exm3.hpp"
#include "libmatlbm.hpp"

static mxChar _array1_[126] = { 'R', 'u', 'n', '-', 't', 'i', 'm', 'e', ' ',
                                'E', 'r', 'r', 'o', 'r', ':', ' ', 'F', 'i',
                                'l', 'e', ':', ' ', 'e', 'x', 'm', '3', ' ',
                                'L', 'i', 'n', 'e', ':', ' ', '1', ' ', 'C',
                                'o', 'l', 'u', 'm', 'n', ':', ' ', '1', ' ',
                                'T', 'h', 'e', ' ', 'f', 'u', 'n', 'c', 't',
                                'i', 'o', 'n', ' ', '"', 'e', 'x', 'm', '3',
                                '"', ' ', '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', ' ', '(', '1', ')', '.' };
static mwArray _mxarray0_ = mclInitializeString(126, _array1_);

static mxChar _array3_[125] = { 'R', 'u', 'n', '-', 't', 'i', 'm', 'e', ' ',
                                'E', 'r', 'r', 'o', 'r', ':', ' ', 'F', 'i',
                                'l', 'e', ':', ' ', 'e', 'x', 'm', '3', ' ',
                                'L', 'i', 'n', 'e', ':', ' ', '1', ' ', 'C',
                                'o', 'l', 'u', 'm', 'n', ':', ' ', '1', ' ',
                                'T', 'h', 'e', ' ', 'f', 'u', 'n', 'c', 't',
                                'i', 'o', 'n', ' ', '"', 'e', 'x', 'm', '3',
                                '"', ' ', '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', ' ', '(', '1', ')', '.' };
static mwArray _mxarray2_ = mclInitializeString(125, _array3_);
static mwArray _mxarray4_ = mclInitializeDouble(0.0);
static mwArray _mxarray5_ = mclInitializeDouble(2.220446049250313e-16);

void InitializeModule_exm3() {
}

void TerminateModule_exm3() {
}

static mwArray Mexm3(int nargout_, mwArray x);

_mexLocalFunctionTable _local_function_table_exm3
  = { 0, (mexFunctionTableEntry *)NULL };

//
// The function "exm3" contains the normal interface for the "exm3" M-function
// from file "D:\mywork\exm3.m" (lines 1-5). This function processes any input
// arguments and passes them to the implementation version of the function,
// appearing above.
//
mwArray exm3(mwArray x) {
    int nargout(1);
    mwArray y(mclGetUninitializedArray());
    y = Mexm3(nargout, x);
    return y;
}

//
// The function "mlxExm3" contains the feval interface for the "exm3"
// M-function from file "D:\mywork\exm3.m" (lines 1-5). The feval function
// calls the implementation version of exm3 through this function. This
// function processes any input arguments and passes them to the implementation
// version of the function, appearing above.
//
void mlxExm3(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
    MW_BEGIN_MLX();
    {
        mwArray mprhs[1];
        mwArray mplhs[1];
        int i;
        mclCppUninitializeArrays(1, mplhs);
        if (nlhs > 1) {
            error(_mxarray0_);
        }
        if (nrhs > 1) {
            error(_mxarray2_);
        }
        for (i = 0; i < 1 && i < nrhs; ++i) {
            mprhs[i] = mwArray(prhs[i], 0);
        }
        for (; i < 1; ++i) {
            mprhs[i].MakeDIN();
        }
        mplhs[0] = Mexm3(nlhs, mprhs[0]);
        plhs[0] = mplhs[0].FreezeData();
    }
    MW_END_MLX();
}

//
// The function "Mexm3" is the implementation version of the "exm3" M-function
// from file "D:\mywork\exm3.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.
//
static mwArray Mexm3(int nargout_, mwArray x) {
    mwLocalFunctionTable save_local_function_table_
      (&_local_function_table_exm3);
    mwArray y(mclGetUninitializedArray());
    x = mwVa(x, "x") + (mwVa(x, "x") == _mxarray4_) * _mxarray5_;
    y = rdivide(mwVe(sin(mwVa(x, "x"))), mwVa(x, "x"));
    mwValidateOutput(y, 1, nargout_, "y", "exm3");
    return y;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -