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

📄 mrandplot.c

📁 一个典型的MATLAB河VC++的混合编程
💻 C
字号:
/*
 * MATLAB Compiler: 3.0
 * Date: Fri Jun 22 20:48:08 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" "-t" "-W"
 * "libhg:MrandplotLib" "mrandplot.m" 
 */
#include "mrandplot.h"
#include "libmatlbm.h"
static mxArray * _mxarray0_;

void InitializeModule_mrandplot(void) {
    _mxarray0_ = mclInitializeDouble(1.0);
}

void TerminateModule_mrandplot(void) {
    mxDestroyArray(_mxarray0_);
}

static mxArray * Mmrandplot(int nargout_, mxArray * n);

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

/*
 * The function "mlfMrandplot" contains the normal interface for the
 * "mrandplot" M-function from file "c:\matlab6p5\matlab c
 * project\code\winmain\mrandplot.m" (lines 1-7). This function processes any
 * input arguments and passes them to the implementation version of the
 * function, appearing above.
 */
mxArray * mlfMrandplot(mxArray * n) {
    int nargout = 1;
    mxArray * noise = NULL;
    mlfEnterNewContext(0, 1, n);
    noise = Mmrandplot(nargout, n);
    mlfRestorePreviousContext(0, 1, n);
    return mlfReturnValue(noise);
}

/*
 * The function "mlxMrandplot" contains the feval interface for the "mrandplot"
 * M-function from file "c:\matlab6p5\matlab c
 * project\code\winmain\mrandplot.m" (lines 1-7). The feval function calls the
 * implementation version of mrandplot through this function. This function
 * processes any input arguments and passes them to the implementation version
 * of the function, appearing above.
 */
void mlxMrandplot(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: mrandplot Line: 1 Column:"
            " 1 The function \"mrandplot\" was called with m"
            "ore than the declared number of outputs (1)."),
          NULL);
    }
    if (nrhs > 1) {
        mlfError(
          mxCreateString(
            "Run-time Error: File: mrandplot Line: 1 Column:"
            " 1 The function \"mrandplot\" 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] = Mmrandplot(nlhs, mprhs[0]);
    mlfRestorePreviousContext(0, 1, mprhs[0]);
    plhs[0] = mplhs[0];
}

/*
 * The function "Mmrandplot" is the implementation version of the "mrandplot"
 * M-function from file "c:\matlab6p5\matlab c
 * project\code\winmain\mrandplot.m" (lines 1-7). 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 noise = mrandplot(n)
 */
static mxArray * Mmrandplot(int nargout_, mxArray * n) {
    mexLocalFunctionTable save_local_function_table_
      = mclSetCurrentLocalFunctionTable(&_local_function_table_mrandplot);
    mxArray * noise = NULL;
    mxArray * ans = NULL;
    mclCopyArray(&n);
    /*
     * %function noise = mrandplot(n)
     * %mrandplot.m
     * noise = rand(n,1);
     */
    mlfAssign(&noise, mlfNRand(1, mclVa(n, "n"), _mxarray0_, NULL));
    /*
     * plot(noise);
     */
    mclAssignAns(&ans, mlfNPlot(0, mclVv(noise, "noise"), NULL));
    mclValidateOutput(noise, 1, nargout_, "noise", "mrandplot");
    mxDestroyArray(ans);
    mxDestroyArray(n);
    mclSetCurrentLocalFunctionTable(save_local_function_table_);
    return noise;
    /*
     * 
     */
}

⌨️ 快捷键说明

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