📄 timestwo.cpp
字号:
#include "mex.h"void timestwo_alt( double *y, double x ){ *y = 2.0 * x;}void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ){ // Create a 1-by-1 matrix for the return argument plhs[0] = mxCreateDoubleMatrix( 1, 1, mxREAL ); // Get the scalar value of the input x // Note: mxGetScalar returns a value, not a pointer double x = mxGetScalar( prhs[0] ); // Assign a pointer to the output double *y = mxGetPr( plhs[0] ); // Call the timestwo_alt subroutine to do the real // work. Because y is pointing to the location // where MATLAB is storing the output value, we // only need to store the result at y for it to // be passed back to MATLAB automatically timestwo_alt(y, x);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -