www.pudn.com > matlab8.zip > exm3.cpp


// 
// MATLAB Compiler: 2.0 
// Date: Fri Mar 24 16:28:38 2000 
// Arguments: "-B" "mccstartup" "-t" "-L" "C" "-A" "annotation:none" "-L" "Cpp" 
// "exm3"  
// 
#include "exm3.hpp" 
 
// 
// The function "Mexm3" is the implementation version of the "exm3" M-function 
// from file "E:\matlab_c\exm3.m" (lines 1-5). 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. 
// 
static mwArray Mexm3(int nargout_, mwArray x) { 
    mwArray y(mclGetUninitializedArray()); 
    mwValidateInputs("exm3", 1, &x); 
    x = x + (x == mwArray(0.0)) * eps(); 
    y = rdivide(sin(x), x); 
    mwValidateOutputs("exm3", 1, nargout_, &y); 
    return y; 
} 
 
// 
// The function "exm3" contains the normal interface for the "exm3" M-function 
// from file "E:\matlab_c\exm3.m" (lines 1-5). This function processes any 
// input arguments and passes them to the implementation version of the 
// function, appearing above. 
// 
mwArray exm3(mwArray x) { 
    int nargout(1); 
    mwArray y(mclGetUninitializedArray()); 
    y = Mexm3(nargout, x); 
    return y; 
} 
 
// 
// The function "mlxExm3" contains the feval interface for the "exm3" 
// M-function from file "E:\matlab_c\exm3.m" (lines 1-5). The feval function 
// calls the implementation version of exm3 through this function. This 
// function processes any input arguments and passes them to the implementation 
// version of the function, appearing above. 
// 
void mlxExm3(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) { 
    MW_BEGIN_MLX(); 
    { 
        mwArray mprhs[1]; 
        mwArray mplhs[1]; 
        int i; 
        if (nlhs > 1) { 
            error( 
              "Run-time Error: File: exm3 Line: 1 Column: " 
              "0 The function \"exm3\" was called with mor" 
              "e than the declared number of outputs (1)"); 
        } 
        if (nrhs > 1) { 
            error( 
              "Run-time Error: File: exm3 Line: 1 Column: 0 The function \"exm3" 
              "\" was called with more than the declared number of inputs (1)"); 
        } 
        for (i = 0; i < 1 && i < nrhs; ++i) { 
            mprhs[i] = mwArray(prhs[i], 0); 
        } 
        for (; i < 1; ++i) { 
            mprhs[i].MakeDIN(); 
        } 
        mplhs[0] = Mexm3(nlhs, mprhs[0]); 
        plhs[0] = mplhs[0].FreezeData(); 
    } 
    MW_END_MLX(); 
}