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

📄 test1.cpp

📁 一个实现vc与matlab接口的程序
💻 CPP
字号:
//
// MATLAB Compiler: 3.0
// Date: Wed Dec 15 15:33: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" "-t" "-L" "Cpp"
// "test1.m" 
//
#include "test1.hpp"
#include "libmatlbm.hpp"

void InitializeModule_test1() {
}

void TerminateModule_test1() {
}

static mwArray Mtest1(mwArray * prod, int nargout_, mwArray x, mwArray y);

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

//
// The function "test1" contains the normal interface for the "test1"
// M-function from file "e:\学习\俺的\engdemo1\test1.m" (lines 1-3). This
// function processes any input arguments and passes them to the implementation
// version of the function, appearing above.
//
mwArray test1(mwArray * prod, mwArray x, mwArray y) {
    int nargout = 1;
    mwArray sum = mwArray::UNDEFINED;
    mwArray prod__ = mwArray::UNDEFINED;
    if (prod != NULL) {
        ++nargout;
    }
    sum = Mtest1(&prod__, nargout, x, y);
    if (prod != NULL) {
        *prod = prod__;
    }
    return sum;
}

//
// The function "mlxTest1" contains the feval interface for the "test1"
// M-function from file "e:\学习\俺的\engdemo1\test1.m" (lines 1-3). The feval
// function calls the implementation version of test1 through this function.
// This function processes any input arguments and passes them to the
// implementation version of the function, appearing above.
//
void mlxTest1(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
    MW_BEGIN_MLX();
    {
        mwArray mprhs[2];
        mwArray mplhs[2];
        int i;
        mclCppUndefineArrays(2, mplhs);
        if (nlhs > 2) {
            error(
              mwVarargin(
                mwArray(
                  "Run-time Error: File: test1 Line: 1 Column: 1"
                  " The function \"test1\" was called with more "
                  "than the declared number of outputs (2).")));
        }
        if (nrhs > 2) {
            error(
              mwVarargin(
                mwArray(
                  "Run-time Error: File: test1 Line: 1 Column: 1"
                  " The function \"test1\" was called with more "
                  "than the declared number of inputs (2).")));
        }
        for (i = 0; i < 2 && i < nrhs; ++i) {
            mprhs[i] = mwArray(prhs[i], 0);
        }
        for (; i < 2; ++i) {
            mprhs[i].MakeDIN();
        }
        mplhs[0] = Mtest1(&mplhs[1], nlhs, mprhs[0], mprhs[1]);
        plhs[0] = mplhs[0].FreezeData();
        for (i = 1; i < 2 && i < nlhs; ++i) {
            plhs[i] = mplhs[i].FreezeData();
        }
    }
    MW_END_MLX();
}

//
// The function "Mtest1" is the implementation version of the "test1"
// M-function from file "e:\学习\俺的\engdemo1\test1.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 [sum,prod]=test1(x,y)
//
static mwArray Mtest1(mwArray * prod, int nargout_, mwArray x, mwArray y) {
    mwLocalFunctionTable save_local_function_table_
      = &_local_function_table_test1;
    mwArray sum = mwArray::UNDEFINED;
    //
    // sum = x*x;
    //
    sum = mwVa(x, "x") * mwVa(x, "x");
    //
    // prod= y*y;
    //
    *prod = mwVa(y, "y") * mwVa(y, "y");
    mwValidateOutput(sum, 1, nargout_, "sum", "test1");
    mwValidateOutput(*prod, 2, nargout_, "prod", "test1");
    return sum;
}

⌨️ 快捷键说明

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