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

📄 showdata.c

📁 压缩包内含有M文件中调用C语言函数的程序
💻 C
字号:
/*
 * MATLAB Compiler: 3.0
 * Date: Fri Jun 22 08:45:52 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" "-m" "-W" "main" "-L"
 * "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "-c" "-B" "sgl" "-m" "-W"
 * "main" "-L" "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "-W" "mainhg"
 * "libmwsglm.mlib" "showdata.m" "getdata.m" 
 */
#include "showdata.h"
#include "getdata.h"
#include "libmatlbm.h"
static mxArray * _mxarray0_;
static mxArray * _mxarray1_;
static mxArray * _mxarray2_;

void InitializeModule_showdata(void) {
    _mxarray0_ = mclInitializeDouble(1.0);
    _mxarray1_ = mclInitializeDouble(100.0);
    _mxarray2_ = mclInitializeDoubleVector(0, 0, (double *)NULL);
}

void TerminateModule_showdata(void) {
    mxDestroyArray(_mxarray2_);
    mxDestroyArray(_mxarray1_);
    mxDestroyArray(_mxarray0_);
}

static void Mshowdata(void);

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

/*
 * The function "mlfShowdata" contains the normal interface for the "showdata"
 * M-function from file "c:\matlab6p5\matlab c project\code\matlab编译器\c_m\no
 * persistent\showdata.m" (lines 1-9). This function processes any input
 * arguments and passes them to the implementation version of the function,
 * appearing above.
 */
void mlfShowdata(void) {
    mlfEnterNewContext(0, 0);
    Mshowdata();
    mlfRestorePreviousContext(0, 0);
}

/*
 * The function "mlxShowdata" contains the feval interface for the "showdata"
 * M-function from file "c:\matlab6p5\matlab c project\code\matlab编译器\c_m\no
 * persistent\showdata.m" (lines 1-9). The feval function calls the
 * implementation version of showdata through this function. This function
 * processes any input arguments and passes them to the implementation version
 * of the function, appearing above.
 */
void mlxShowdata(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
    if (nlhs > 0) {
        mlfError(
          mxCreateString(
            "Run-time Error: File: showdata Line: 1 Column:"
            " 1 The function \"showdata\" was called with m"
            "ore than the declared number of outputs (0)."),
          NULL);
    }
    if (nrhs > 0) {
        mlfError(
          mxCreateString(
            "Run-time Error: File: showdata Line: 1 Column:"
            " 1 The function \"showdata\" was called with m"
            "ore than the declared number of inputs (0)."),
          NULL);
    }
    mlfEnterNewContext(0, 0);
    Mshowdata();
    mlfRestorePreviousContext(0, 0);
}

/*
 * The function "Mshowdata" is the implementation version of the "showdata"
 * M-function from file "c:\matlab6p5\matlab c project\code\matlab编译器\c_m\no
 * persistent\showdata.m" (lines 1-9). 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 showdata
 */
static void Mshowdata(void) {
    mexLocalFunctionTable save_local_function_table_
      = mclSetCurrentLocalFunctionTable(&_local_function_table_showdata);
    mxArray * ans = NULL;
    mxArray * i = NULL;
    mxArray * y = NULL;
    /*
     * %showdata.m
     * y = zeros(1, 100); % pre-allocate the matrix 
     */
    mlfAssign(&y, mlfZeros(_mxarray0_, _mxarray1_, NULL));
    /*
     * for i = 1:100 
     */
    {
        int v_ = mclForIntStart(1);
        int e_ = 100;
        if (v_ > e_) {
            mlfAssign(&i, _mxarray2_);
        } else {
            /*
             * y(i) = getdata; 
             * end
             */
            for (; ; ) {
                mclIntArrayAssign1(&y, mlfGetdata(), v_);
                if (v_ == e_) {
                    break;
                }
                ++v_;
            }
            mlfAssign(&i, mlfScalar(v_));
        }
    }
    /*
     * plot(y);
     */
    mclAssignAns(&ans, mlfNPlot(0, mclVv(y, "y"), NULL));
    mxDestroyArray(y);
    mxDestroyArray(i);
    mxDestroyArray(ans);
    mclSetCurrentLocalFunctionTable(save_local_function_table_);
    /*
     * 
     */
}

⌨️ 快捷键说明

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