📄 plotrand.c
字号:
/*
* MATLAB Compiler: 3.0
* Date: Sun Oct 24 16:42:12 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" "-B" "sgl" "-m" "-W"
* "main" "-L" "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "-W" "mainhg"
* "libmwsglm.mlib" "plotrand.m"
*/
#include "plotrand.h"
#include "libmatlbm.h"
static mxArray * _mxarray0_;
static mxArray * _mxarray1_;
void InitializeModule_plotrand(void) {
_mxarray0_ = mclInitializeDouble(1000.0);
_mxarray1_ = mclInitializeDouble(1.0);
}
void TerminateModule_plotrand(void) {
mxDestroyArray(_mxarray1_);
mxDestroyArray(_mxarray0_);
}
static mxArray * Mplotrand(int nargout_);
_mexLocalFunctionTable _local_function_table_plotrand
= { 0, (mexFunctionTableEntry *)NULL };
/*
* The function "mlfPlotrand" contains the normal interface for the "plotrand"
* M-function from file "f:\matlab
* c_c++混合编程\book\去掉黑框\改变dos程序的输出\testredirectoutput\plotrand\plo
* trand.m" (lines 1-7). This function processes any input arguments and passes
* them to the implementation version of the function, appearing above.
*/
mxArray * mlfPlotrand(void) {
int nargout = 1;
mxArray * y = NULL;
mlfEnterNewContext(0, 0);
y = Mplotrand(nargout);
mlfRestorePreviousContext(0, 0);
return mlfReturnValue(y);
}
/*
* The function "mlxPlotrand" contains the feval interface for the "plotrand"
* M-function from file "f:\matlab
* c_c++混合编程\book\去掉黑框\改变dos程序的输出\testredirectoutput\plotrand\plo
* trand.m" (lines 1-7). The feval function calls the implementation version of
* plotrand through this function. This function processes any input arguments
* and passes them to the implementation version of the function, appearing
* above.
*/
void mlxPlotrand(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
mxArray * mplhs[1];
int i;
if (nlhs > 1) {
mlfError(
mxCreateString(
"Run-time Error: File: plotrand Line: 1 Column:"
" 1 The function \"plotrand\" was called with m"
"ore than the declared number of outputs (1)."),
NULL);
}
if (nrhs > 0) {
mlfError(
mxCreateString(
"Run-time Error: File: plotrand Line: 1 Column:"
" 1 The function \"plotrand\" was called with m"
"ore than the declared number of inputs (0)."),
NULL);
}
for (i = 0; i < 1; ++i) {
mplhs[i] = NULL;
}
mlfEnterNewContext(0, 0);
mplhs[0] = Mplotrand(nlhs);
mlfRestorePreviousContext(0, 0);
plhs[0] = mplhs[0];
}
/*
* The function "Mplotrand" is the implementation version of the "plotrand"
* M-function from file "f:\matlab
* c_c++混合编程\book\去掉黑框\改变dos程序的输出\testredirectoutput\plotrand\plo
* trand.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 [y]=plotrand()
*/
static mxArray * Mplotrand(int nargout_) {
mexLocalFunctionTable save_local_function_table_
= mclSetCurrentLocalFunctionTable(&_local_function_table_plotrand);
mxArray * y = NULL;
mxArray * ans = NULL;
mxArray * N = NULL;
/*
* %function [y]=plotrand()
* N = 1000;
*/
mlfAssign(&N, _mxarray0_);
/*
* y=rand(1,N);
*/
mlfAssign(&y, mlfNRand(1, _mxarray1_, mclVv(N, "N"), NULL));
/*
* disp(y);
*/
mlfDisp(mclVv(y, "y"));
/*
* plot(y);
*/
mclAssignAns(&ans, mlfNPlot(0, mclVv(y, "y"), NULL));
mclValidateOutput(y, 1, nargout_, "y", "plotrand");
mxDestroyArray(N);
mxDestroyArray(ans);
mclSetCurrentLocalFunctionTable(save_local_function_table_);
return y;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -