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

📄 ball.c

📁 精通Matlab与C_C++混合程序设计.rar 是精通Matlab与C_C++混合程序设计 这本书的配套源码
💻 C
📖 第 1 页 / 共 4 页
字号:
/*
 * MATLAB Compiler: 3.0
 * Date: Fri Oct 01 19:20:59 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" "C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R13\mccpath" "-I" "D:\MATLAB6p5\toolbox\matlab\general" "-I" "D:\MATLAB6p5\toolbox\matlab\ops" "-I" "D:\MATLAB6p5\toolbox\matlab\lang" "-I" "D:\MATLAB6p5\toolbox\matlab\elmat" "-I" "D:\MATLAB6p5\toolbox\matlab\elfun" "-I" "D:\MATLAB6p5\toolbox\matlab\specfun" "-I" "D:\MATLAB6p5\toolbox\matlab\matfun" "-I" "D:\MATLAB6p5\toolbox\matlab\datafun" "-I" "D:\MATLAB6p5\toolbox\matlab\audio" "-I" "D:\MATLAB6p5\toolbox\matlab\polyfun" "-I" "D:\MATLAB6p5\toolbox\matlab\funfun" "-I" "D:\MATLAB6p5\toolbox\matlab\sparfun" "-I" "D:\MATLAB6p5\toolbox\matlab\graph2d" "-I" "D:\MATLAB6p5\toolbox\matlab\graph3d" "-I" "D:\MATLAB6p5\toolbox\matlab\specgraph" "-I" "D:\MATLAB6p5\toolbox\matlab\graphics" "-I" "D:\MATLAB6p5\toolbox\matlab\uitools" "-I" "D:\MATLAB6p5\toolbox\matlab\strfun" "-I" "D:\MATLAB6p5\toolbox\matlab\iofun" "-I" "D:\MATLAB6p5\toolbox\matlab\timefun" "-I" "D:\MATLAB6p5\toolbox\matlab\datatypes" "-I" "D:\MATLAB6p5\toolbox\matlab\verctrl" "-I" "D:\MATLAB6p5\toolbox\matlab\winfun" "-I" "D:\MATLAB6p5\toolbox\matlab\winfun\comcli" "-I" "D:\MATLAB6p5\toolbox\matlab\demos" "-I" "D:\MATLAB6p5\toolbox\local" "-I" "D:\MATLAB6p5\toolbox\simulink\simulink" "-I" "D:\MATLAB6p5\toolbox\simulink\blocks" "-I" "D:\MATLAB6p5\toolbox\simulink\components" "-I" "D:\MATLAB6p5\toolbox\simulink\fixedandfloat" "-I" "D:\MATLAB6p5\toolbox\simulink\fixedandfloat\fxpdemos" "-I" "D:\MATLAB6p5\toolbox\simulink\fixedandfloat\obsolete" "-I" "D:\MATLAB6p5\toolbox\simulink\simdemos" "-I" "D:\MATLAB6p5\toolbox\simulink\simdemos\aerospace" "-I" "D:\MATLAB6p5\toolbox\simulink\simdemos\automotive" "-I" "D:\MATLAB6p5\toolbox\simulink\simdemos\simfeatures" "-I" "D:\MATLAB6p5\toolbox\simulink\simdemos\simgeneral" "-I" "D:\MATLAB6p5\toolbox\simulink\simdemos\simnew" "-I"
 * "D:\MATLAB6p5\toolbox\simulink\dee" "-I" "D:\MATLAB6p5\toolbox\simulink\dastudio" "-I" "D:\MATLAB6p5\toolbox\stateflow\stateflow" "-I" "D:\MATLAB6p5\toolbox\stateflow\sfdemos" "-I" "D:\MATLAB6p5\toolbox\stateflow\coder" "-I" "D:\MATLAB6p5\toolbox\rtw\targets\rtwin\rtwin" "-I" "D:\MATLAB6p5\toolbox\rtw\rtw" "-I" "D:\MATLAB6p5\toolbox\rtw\rtwdemos" "-I" "D:\MATLAB6p5\toolbox\rtw\rtwdemos\rsimdemos" "-I" "D:\MATLAB6p5\toolbox\rtw\targets\asap2\asap2" "-I" "D:\MATLAB6p5\toolbox\rtw\targets\asap2\asap2\user" "-I" "D:\MATLAB6p5\toolbox\aeroblks\aeroblks" "-I" "D:\MATLAB6p5\toolbox\aeroblks\aerodemos" "-I" "D:\MATLAB6p5\toolbox\cdma\cdma" "-I" "D:\MATLAB6p5\toolbox\cdma\cdmamasks" "-I" "D:\MATLAB6p5\toolbox\cdma\cdmamex" "-I" "D:\MATLAB6p5\toolbox\cdma\cdmademos" "-I" "D:\MATLAB6p5\toolbox\commblks\commblks" "-I" "D:\MATLAB6p5\toolbox\commblks\commmasks" "-I" "D:\MATLAB6p5\toolbox\commblks\commmex" "-I" "D:\MATLAB6p5\toolbox\commblks\commblksdemos" "-I" "D:\MATLAB6p5\toolbox\commblks\commblksobsolete\commblksobsolete" "-I" "D:\MATLAB6p5\toolbox\comm\comm" "-I" "D:\MATLAB6p5\toolbox\comm\commdemos" "-I" "D:\MATLAB6p5\toolbox\comm\commobsolete" "-I" "D:\MATLAB6p5\toolbox\control\control" "-I" "D:\MATLAB6p5\toolbox\control\ctrlguis" "-I" "D:\MATLAB6p5\toolbox\control\ctrlobsolete" "-I" "D:\MATLAB6p5\toolbox\control\ctrlutil" "-I" "D:\MATLAB6p5\toolbox\control\ctrldemos" "-I" "D:\MATLAB6p5\toolbox\curvefit\curvefit" "-I" "D:\MATLAB6p5\toolbox\curvefit\cftoolgui" "-I" "D:\MATLAB6p5\toolbox\dspblks\dspblks" "-I" "D:\MATLAB6p5\toolbox\dspblks\dspmasks" "-I" "D:\MATLAB6p5\toolbox\dspblks\dspmex" "-I" "D:\MATLAB6p5\toolbox\dspblks\dspdemos" "-I" "D:\MATLAB6p5\toolbox\daq\daq" "-I" "D:\MATLAB6p5\toolbox\daq\daqguis" "-I" "D:\MATLAB6p5\toolbox\daq\daqdemos" "-I" "D:\MATLAB6p5\toolbox\database\database" "-I" "D:\MATLAB6p5\toolbox\database\dbdemos" "-I" "D:\MATLAB6p5\toolbox\database\vqb" "-I" "D:\MATLAB6p5\toolbox\datafeed\datafeed" "-I" "D:\MATLAB6p5\toolbox\datafeed\dfgui" "-I" "D:\MATLAB6p5\toolbox\dials" "-I"
 * "D:\MATLAB6p5\toolbox\rtw\targets\mpc555dk\mpc555dk" "-I" "D:\MATLAB6p5\toolbox\rtw\targets\mpc555dk\common\canlib\blockset" "-I" "D:\MATLAB6p5\toolbox\rtw\targets\mpc555dk\common\canlib\blockset\mfiles" "-I" "D:\MATLAB6p5\toolbox\rtw\targets\mpc555dk\common\vectorlib\blockset" "-I" "D:\MATLAB6p5\toolbox\rtw\targets\mpc555dk\common\vectorlib\blockset\mfiles" "-I" "D:\MATLAB6p5\toolbox\rtw\targets\mpc555dk\common\configuration" "-I" "D:\MATLAB6p5\toolbox\rtw\targets\mpc555dk\pil" "-I" "D:\MATLAB6p5\toolbox\rtw\targets\mpc555dk\rt\blockset" "-I" "D:\MATLAB6p5\toolbox\rtw\targets\mpc555dk\rt\blockset\mfiles" "-I" "D:\MATLAB6p5\toolbox\rtw\targets\mpc555dk\rt\blockset\mfiles\SimulinkUtilities" "-I" "D:\MATLAB6p5\toolbox\rtw\targets\mpc555dk\mpc555demos" "-I" "D:\MATLAB6p5\toolbox\rtw\targets\tic6000\tic6000" "-I" "D:\MATLAB6p5\toolbox\rtw\targets\tic6000\blks" "-I" "D:\MATLAB6p5\toolbox\exlink" "-I" "D:\MATLAB6p5\toolbox\symbolic" "-I" "D:\MATLAB6p5\toolbox\filterdesign\filterdesign" "-I" "D:\MATLAB6p5\toolbox\filterdesign\quantization" "-I" "D:\MATLAB6p5\toolbox\filterdesign\filtdesdemos" "-I" "D:\MATLAB6p5\toolbox\finderiv\finderiv" "-I" "D:\MATLAB6p5\toolbox\ftseries\ftseries" "-I" "D:\MATLAB6p5\toolbox\ftseries\ftsdemos" "-I" "D:\MATLAB6p5\toolbox\ftseries\ftsdata" "-I" "D:\MATLAB6p5\toolbox\ftseries\ftstutorials" "-I" "D:\MATLAB6p5\toolbox\finance\finance" "-I" "D:\MATLAB6p5\toolbox\finance\calendar" "-I" "D:\MATLAB6p5\toolbox\finance\findemos" "-I" "D:\MATLAB6p5\toolbox\finance\finsupport" "-I" "D:\MATLAB6p5\toolbox\fixpoint" "-I" "D:\MATLAB6p5\toolbox\fuzzy\fuzzy" "-I" "D:\MATLAB6p5\toolbox\fuzzy\fuzdemos" "-I" "D:\MATLAB6p5\toolbox\garch\garch" "-I" "D:\MATLAB6p5\toolbox\garch\garchdemos" "-I" "D:\MATLAB6p5\toolbox\images\images" "-I" "D:\MATLAB6p5\toolbox\images\imdemos" "-I" "D:\MATLAB6p5\toolbox\instrument\instrument" "-I" "D:\MATLAB6p5\toolbox\instrument\instrumentdemos" "-I" "D:\MATLAB6p5\toolbox\lmi\lmictrl" "-I" "D:\MATLAB6p5\toolbox\lmi\lmilab" "-I" "D:\MATLAB6p5\toolbox\combuilder\combuilder"
 * "-I" "D:\MATLAB6p5\toolbox\compiler" "-I" "D:\MATLAB6p5\toolbox\matlabxl\matlabxl" "-I" "D:\MATLAB6p5\toolbox\ccslink\ccslink" "-I" "D:\MATLAB6p5\toolbox\ccslink\ccsdemos" "-I" "D:\MATLAB6p5\toolbox\ccslink\rtdxblks" "-I" "D:\MATLAB6p5\toolbox\rptgen" "-I" "D:\MATLAB6p5\toolbox\runtime" "-I" "D:\MATLAB6p5\toolbox\webserver\webserver" "-I" "D:\MATLAB6p5\toolbox\webserver\wsdemos" "-I" "D:\MATLAB6p5\toolbox\map\map" "-I" "D:\MATLAB6p5\toolbox\map\mapdisp" "-I" "D:\MATLAB6p5\toolbox\map\mapproj" "-I" "D:\MATLAB6p5\toolbox\mpc\mpccmds" "-I" "D:\MATLAB6p5\toolbox\mpc\mpcdemos" "-I" "D:\MATLAB6p5\toolbox\mbc\mbc" "-I" "D:\MATLAB6p5\toolbox\mbc\mbcdata" "-I" "D:\MATLAB6p5\toolbox\mbc\mbcdesign" "-I" "D:\MATLAB6p5\toolbox\mbc\mbcexpr" "-I" "D:\MATLAB6p5\toolbox\mbc\mbcguitools" "-I" "D:\MATLAB6p5\toolbox\mbc\mbclayouts" "-I" "D:\MATLAB6p5\toolbox\mbc\mbcmodels" "-I" "D:\MATLAB6p5\toolbox\mbc\mbcsimulink" "-I" "D:\MATLAB6p5\toolbox\mbc\mbctools" "-I" "D:\MATLAB6p5\toolbox\mbc\mbcview" "-I" "D:\MATLAB6p5\toolbox\mutools\commands" "-I" "D:\MATLAB6p5\toolbox\mutools\subs" "-I" "D:\MATLAB6p5\toolbox\nnet\nnet" "-I" "D:\MATLAB6p5\toolbox\nnet\nnutils" "-I" "D:\MATLAB6p5\toolbox\nnet\nncontrol" "-I" "D:\MATLAB6p5\toolbox\nnet\nndemos" "-I" "D:\MATLAB6p5\toolbox\nnet\nnobsolete" "-I" "D:\MATLAB6p5\toolbox\ncd" "-I" "D:\MATLAB6p5\toolbox\optim" "-I" "D:\MATLAB6p5\toolbox\pde" "-I" "D:\MATLAB6p5\toolbox\rtw\targets\ecoder" "-I" "D:\MATLAB6p5\toolbox\rtw\targets\ecoder\ecoderdemos" "-I" "D:\MATLAB6p5\toolbox\reqmgt" "-I" "D:\MATLAB6p5\toolbox\robust" "-I" "D:\MATLAB6p5\toolbox\sb2sl" "-I" "D:\MATLAB6p5\toolbox\signal\signal" "-I" "D:\MATLAB6p5\toolbox\signal\sigtools" "-I" "D:\MATLAB6p5\toolbox\signal\sptoolgui" "-I" "D:\MATLAB6p5\toolbox\signal\sigdemos" "-I" "D:\MATLAB6p5\toolbox\physmod\mech\mech" "-I" "D:\MATLAB6p5\toolbox\physmod\mech\mechdemos" "-I" "D:\MATLAB6p5\toolbox\powersys\powersys" "-I" "D:\MATLAB6p5\toolbox\powersys\powerdemo" "-I" "D:\MATLAB6p5\toolbox\simulink\perftools" "-I"
 * "D:\MATLAB6p5\toolbox\simulink\mdldiff" "-I" "D:\MATLAB6p5\toolbox\simulink\simcoverage" "-I" "D:\MATLAB6p5\toolbox\rtw\accel" "-I" "D:\MATLAB6p5\toolbox\rptgenext" "-I" "D:\MATLAB6p5\toolbox\splines" "-I" "D:\MATLAB6p5\toolbox\stats" "-I" "D:\MATLAB6p5\toolbox\ident\ident" "-I" "D:\MATLAB6p5\toolbox\ident\idobsolete" "-I" "D:\MATLAB6p5\toolbox\ident\idguis" "-I" "D:\MATLAB6p5\toolbox\ident\idutils" "-I" "D:\MATLAB6p5\toolbox\ident\iddemos" "-I" "D:\MATLAB6p5\toolbox\ident\idhelp" "-I" "D:\MATLAB6p5\toolbox\vr\vr" "-I" "D:\MATLAB6p5\toolbox\vr\vrdemos" "-I" "D:\MATLAB6p5\toolbox\wavelet\wavelet" "-I" "D:\MATLAB6p5\toolbox\wavelet\wavedemo" "-I" "D:\MATLAB6p5\toolbox\rtw\targets\xpc\xpc" "-I" "D:\MATLAB6p5\toolbox\rtw\targets\xpc\target\build\xpcblocks" "-I" "D:\MATLAB6p5\toolbox\rtw\targets\xpc\xpcdemos" "-I" "D:\MATLAB6p5\toolbox\rtw\targets\xpc\target\kernel\embedded" "-I" "D:\MATLAB6p5\work" "-L" "C" "libmmfile.mlib" "libmwsglm.mlib" "-A" "line:on" "-G" "-A" "debugline:on" "-O" "fold_scalar_mxarrays:off" "-O" "fold_non_scalar_mxarrays:off" "-O" "optimize_integer_for_loops:off" "-O" "array_indexing:off" "-O" "optimize_conditionals:off" "-O" "speculate:off" "libmmfile.mlib" "libmwsglm.mlib" "-v" "-I" "F:\book\ball" "-t" "-T" "codegen" "F:\book\ball\ball.m" 
 */
#include "ball.h"
#include "gui_mainfcn.h"
#include "guidata.h"
#include "libmatlbm.h"
#include "libmmfile.h"

static double _array0_[3] = { 0.5, 0.7, 0.3 };

static double _array1_[4] = { 0.0, 0.0, 1.0, 1.0 };

static double _array2_[4] = { 0.0, 1.0, 0.0, 1.0 };

static double _array3_[4] = { 0.0, 1.0, 1.0, 0.0 };

static double _array4_[2] = { 0.5, 0.5 };

static double _array5_[2] = { 0.3, 0.3 };

static double _array6_[63] = { 0.0, .1, .2, .30000000000000004, .4, .5, .6000000000000001, .7000000000000001, .8, .9, 1.0, 1.1, 1.2000000000000002, 1.3, 1.4000000000000001, 1.5, 1.6, 1.7000000000000002, 1.8, 1.9000000000000001, 2.0, 2.1, 2.2, 2.3000000000000003, 2.4000000000000004, 2.5, 2.6, 2.7, 2.8000000000000003, 2.9000000000000004, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5.0, 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, 6.0, 6.1000000000000005, 6.2 };

void InitializeModule_ball(void) {
}

void TerminateModule_ball(void) {
}

static void mlfBall_ball_OpeningFcn(mxArray * hObject, mxArray * eventdata, mxArray * handles, ...);
static void mlxBall_ball_OpeningFcn(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]);
static mxArray * mlfBall_ball_OutputFcn(mlfVarargoutList * varargout, mxArray * hObject, mxArray * eventdata, mxArray * handles);
static void mlxBall_ball_OutputFcn(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]);
static mxArray * mlfBall_getnextball(mxArray * * newydata, mxArray * * newposition, mxArray * * newdire, mxArray * xdata, mxArray * ydata, mxArray * preposition, mxArray * predire, mxArray * dx, mxArray * dy);
static void mlxBall_getnextball(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]);
static mxArray * Mball(int nargout_, mxArray * varargin);
static void Mball_ball_OpeningFcn(mxArray * hObject, mxArray * eventdata, mxArray * handles, mxArray * varargin);
static mxArray * Mball_ball_OutputFcn(int nargout_, mxArray * hObject, mxArray * eventdata, mxArray * handles);
static mxArray * Mball_getnextball(mxArray * * newydata, mxArray * * newposition, mxArray * * newdire, int nargout_, mxArray * xdata, mxArray * ydata, mxArray * preposition, mxArray * predire, mxArray * dx, mxArray * dy);

static mexFunctionTableEntry local_function_table_[3] = { { "ball_OpeningFcn", mlxBall_ball_OpeningFcn, -4, 0, NULL }, { "ball_OutputFcn", mlxBall_ball_OutputFcn, 3, -1, NULL }, { "getnextball", mlxBall_getnextball, 6, 4, NULL } };

_mexLocalFunctionTable _local_function_table_ball = { 3, local_function_table_ };

/*
 * The function "mlfNBall" contains the nargout interface for the "ball" M-function from file "f:\book\ball\ball.m" (lines 1-48). This interface is only produced if the M-function uses the special variable "nargout". The nargout interface allows the number of requested outputs to be specified via the nargout argument, as opposed to the normal interface which dynamically calculates the number of outputs based on the number of non-NULL inputs it receives. This function processes any input arguments and passes them to the implementation version of the function, appearing above.
 */
mxArray * mlfNBall(int nargout, mlfVarargoutList * varargout, ...) {
    mxArray * varargin = NULL;
    mlfVarargin(&varargin, varargout, 0);
    mlfEnterNewContext(0, -1, varargin);
    nargout += mclNargout(varargout);
    *mlfGetVarargoutCellPtr(varargout) = Mball(nargout, varargin);
    mlfRestorePreviousContext(0, 0);
    mxDestroyArray(varargin);
    return mlfAssignOutputs(varargout);
}

/*
 * The function "mlfBall" contains the normal interface for the "ball" M-function from file "f:\book\ball\ball.m" (lines 1-48). This function processes any input arguments and passes them to the implementation version of the function, appearing above.
 */
mxArray * mlfBall(mlfVarargoutList * varargout, ...) {
    mxArray * varargin = NULL;
    int nargout = 0;
    mlfVarargin(&varargin, varargout, 0);
    mlfEnterNewContext(0, -1, varargin);
    nargout += mclNargout(varargout);
    *mlfGetVarargoutCellPtr(varargout) = Mball(nargout, varargin);
    mlfRestorePreviousContext(0, 0);
    mxDestroyArray(varargin);
    return mlfAssignOutputs(varargout);
}

/*
 * The function "mlfVBall" contains the void interface for the "ball" M-function from file "f:\book\ball\ball.m" (lines 1-48). The void interface is only produced if the M-function uses the special variable "nargout", and has at least one output. The void interface function specifies zero output arguments to the implementation version of the function, and in the event that the implementation version still returns an output (which, in MATLAB, would be assigned to the "ans" variable), it deallocates the output. This function processes any input arguments and passes them to the implementation version of the function, appearing above.
 */
void mlfVBall(mxArray * synthetic_varargin_argument, ...) {
    mxArray * varargin = NULL;
    mxArray * varargout = NULL;
    mlfVarargin(&varargin, synthetic_varargin_argument, 1);
    mlfEnterNewContext(0, -1, varargin);
    varargout = Mball(0, synthetic_varargin_argument);
    mlfRestorePreviousContext(0, 0);
    mxDestroyArray(varargin);
}

/*
 * The function "mlxBall" contains the feval interface for the "ball" M-function from file "f:\book\ball\ball.m" (lines 1-48). The feval function calls the implementation version of ball through this function. This function processes any input arguments and passes them to the implementation version of the function, appearing above.
 */
void mlxBall(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
    mxArray * mprhs[1];
    mxArray * mplhs[1];
    int i;
    for (i = 0; i < 1; ++i) {
        mplhs[i] = NULL;
    }
    mlfEnterNewContext(0, 0);
    mprhs[0] = NULL;
    mlfAssign(&mprhs[0], mclCreateVararginCell(nrhs, prhs));
    mplhs[0] = Mball(nlhs, mprhs[0]);
    mclAssignVarargoutCell(0, nlhs, plhs, mplhs[0]);
    mlfRestorePreviousContext(0, 0);
    mxDestroyArray(mprhs[0]);
}

/*
 * The function "mlfBall_ball_OpeningFcn" contains the normal interface for the "ball/ball_OpeningFcn" M-function from file "f:\book\ball\ball.m" (lines 48-107). This function processes any input arguments and passes them to the implementation version of the function, appearing above.
 */
static void mlfBall_ball_OpeningFcn(mxArray * hObject, mxArray * eventdata, mxArray * handles, ...) {
    mxArray * varargin = NULL;
    mlfVarargin(&varargin, handles, 0);
    mlfEnterNewContext(0, -4, hObject, eventdata, handles, varargin);
    Mball_ball_OpeningFcn(hObject, eventdata, handles, varargin);
    mlfRestorePreviousContext(0, 3, hObject, eventdata, handles);
    mxDestroyArray(varargin);
}

/*
 * The function "mlxBall_ball_OpeningFcn" contains the feval interface for the "ball/ball_OpeningFcn" M-function from file "f:\book\ball\ball.m" (lines 48-107). The feval function calls the implementation version of ball/ball_OpeningFcn through this function. This function processes any input arguments and passes them to the implementation version of the function, appearing above.
 */
static void mlxBall_ball_OpeningFcn(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
    mxArray * mprhs[4];
    int i;
    if (nlhs > 0) {
        mlfError(mxCreateString("Run-time Error: File: ball/ball_OpeningFcn Line: 48 Column: 1 The function \"ball/ball_OpeningFcn\" was called with more than the declared number of outputs (0)."), NULL);
    }
    for (i = 0; i < 3 && i < nrhs; ++i) {
        mprhs[i] = prhs[i];
    }
    for (; i < 3; ++i) {
        mprhs[i] = NULL;
    }
    mlfEnterNewContext(0, 3, mprhs[0], mprhs[1], mprhs[2]);
    mprhs[3] = NULL;
    mlfAssign(&mprhs[3], mclCreateVararginCell(nrhs - 3, prhs + 3));
    Mball_ball_OpeningFcn(mprhs[0], mprhs[1], mprhs[2], mprhs[3]);
    mlfRestorePreviousContext(0, 3, mprhs[0], mprhs[1], mprhs[2]);
    mxDestroyArray(mprhs[3]);
}

/*
 * The function "mlfBall_ball_OutputFcn" contains the normal interface for the "ball/ball_OutputFcn" M-function from file "f:\book\ball\ball.m" (lines 107-116). This function processes any input arguments and passes them to the implementation version of the function, appearing above.
 */
static mxArray * mlfBall_ball_OutputFcn(mlfVarargoutList * varargout, mxArray * hObject, mxArray * eventdata, mxArray * handles) {
    int nargout = 0;
    mlfEnterNewContext(0, 3, hObject, eventdata, handles);
    nargout += mclNargout(varargout);
    *mlfGetVarargoutCellPtr(varargout) = Mball_ball_OutputFcn(nargout, hObject, eventdata, handles);
    mlfRestorePreviousContext(0, 3, hObject, eventdata, handles);
    return mlfAssignOutputs(varargout);
}

/*
 * The function "mlxBall_ball_OutputFcn" contains the feval interface for the "ball/ball_OutputFcn" M-function from file "f:\book\ball\ball.m" (lines 107-116). The feval function calls the implementation version of ball/ball_OutputFcn through this function. This function processes any input arguments and passes them to the implementation version of the function, appearing above.
 */
static void mlxBall_ball_OutputFcn(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
    mxArray * mprhs[3];
    mxArray * mplhs[1];
    int i;
    if (nrhs > 3) {
        mlfError(mxCreateString("Run-time Error: File: ball/ball_OutputFcn Line: 107 Column: 1 The function \"ball/ball_OutputFcn\" was called with more than the declared number of inputs (3)."), NULL);
    }
    for (i = 0; i < 1; ++i) {
        mplhs[i] = NULL;
    }
    for (i = 0; i < 3 && i < nrhs; ++i) {
        mprhs[i] = prhs[i];
    }
    for (; i < 3; ++i) {
        mprhs[i] = NULL;
    }
    mlfEnterNewContext(0, 3, mprhs[0], mprhs[1], mprhs[2]);
    mplhs[0] = Mball_ball_OutputFcn(nlhs, mprhs[0], mprhs[1], mprhs[2]);
    mclAssignVarargoutCell(0, nlhs, plhs, mplhs[0]);
    mlfRestorePreviousContext(0, 3, mprhs[0], mprhs[1], mprhs[2]);
}

/*
 * The function "mlfBall_getnextball" contains the normal interface for the "ball/getnextball" M-function from file "f:\book\ball\ball.m" (lines 116-158). This function processes any input arguments and passes them to the implementation version of the function, appearing above.
 */
static mxArray * mlfBall_getnextball(mxArray * * newydata, mxArray * * newposition, mxArray * * newdire, mxArray * xdata, mxArray * ydata, mxArray * preposition, mxArray * predire, mxArray * dx, mxArray * dy) {
    int nargout = 1;
    mxArray * newxdata = NULL;
    mxArray * newydata__ = NULL;
    mxArray * newposition__ = NULL;
    mxArray * newdire__ = NULL;
    mlfEnterNewContext(3, 6, newydata, newposition, newdire, xdata, ydata, preposition, predire, dx, dy);
    if (newydata != NULL) {
        ++nargout;
    }
    if (newposition != NULL) {
        ++nargout;
    }
    if (newdire != NULL) {
        ++nargout;
    }
    newxdata = Mball_getnextball(&newydata__, &newposition__, &newdire__, nargout, xdata, ydata, preposition, predire, dx, dy);
    mlfRestorePreviousContext(3, 6, newydata, newposition, newdire, xdata, ydata, preposition, predire, dx, dy);
    if (newydata != NULL) {
        mclCopyOutputArg(newydata, newydata__);
    } else {
        mxDestroyArray(newydata__);
    }
    if (newposition != NULL) {
        mclCopyOutputArg(newposition, newposition__);
    } else {
        mxDestroyArray(newposition__);
    }
    if (newdire != NULL) {
        mclCopyOutputArg(newdire, newdire__);
    } else {
        mxDestroyArray(newdire__);
    }
    return mlfReturnValue(newxdata);
}

/*
 * The function "mlxBall_getnextball" contains the feval interface for the "ball/getnextball" M-function from file "f:\book\ball\ball.m" (lines 116-158). The feval function calls the implementation version of ball/getnextball through this function. This function processes any input arguments and passes them to the implementation version of the function, appearing above.
 */
static void mlxBall_getnextball(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
    mxArray * mprhs[6];
    mxArray * mplhs[4];
    int i;
    if (nlhs > 4) {
        mlfError(mxCreateString("Run-time Error: File: ball/getnextball Line: 116 Column: 1 The function \"ball/getnextball\" was called with more than the declared number of outputs (4)."), NULL);
    }
    if (nrhs > 6) {
        mlfError(mxCreateString("Run-time Error: File: ball/getnextball Line: 116 Column: 1 The function \"ball/getnextball\" was called with more than the declared number of inputs (6)."), NULL);
    }
    for (i = 0; i < 4; ++i) {
        mplhs[i] = NULL;
    }
    for (i = 0; i < 6 && i < nrhs; ++i) {
        mprhs[i] = prhs[i];
    }
    for (; i < 6; ++i) {
        mprhs[i] = NULL;
    }
    mlfEnterNewContext(0, 6, mprhs[0], mprhs[1], mprhs[2], mprhs[3], mprhs[4], mprhs[5]);
    mplhs[0] = Mball_getnextball(&mplhs[1], &mplhs[2], &mplhs[3], nlhs, mprhs[0], mprhs[1], mprhs[2], mprhs[3], mprhs[4], mprhs[5]);
    mlfRestorePreviousContext(0, 6, mprhs[0], mprhs[1], mprhs[2], mprhs[3], mprhs[4], mprhs[5]);
    plhs[0] = mplhs[0];
    for (i = 1; i < 4 && i < nlhs; ++i) {
        plhs[i] = mplhs[i];
    }
    for (; i < 4; ++i) {
        mxDestroyArray(mplhs[i]);
    }
}

/*
 * The function "Mball" is the implementation version of the "ball" M-function from file "f:\book\ball\ball.m" (lines 1-48). 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.
 */

⌨️ 快捷键说明

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