📄 main.cpp
字号:
#include "stdafx.h"
#include "wave.h"
#include "mex.h"
#define WAVE_IN_START 1
#define WAVE_IN_STOP 2
#define WAVE_GET_DATA 3
#define WAVE_GET_E 4
#define WAVE_GET_Z 5
void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[]
)
{
double *ret;
int cmd, len;
if (nrhs <1 || !mxIsNumeric(prhs[0]))
mexErrMsgTxt("命令格式错误");
cmd = (int)* mxGetPr(prhs[0]);
switch (cmd)
{
case WAVE_IN_START:
wave_start();
break;
case WAVE_IN_STOP:
wave_stop();
break;
case WAVE_GET_DATA:
len = wave_get_len();
plhs[0] = mxCreateDoubleMatrix(len, 1, mxREAL);
ret = mxGetPr(plhs[0]);
if (len==0) break;
wave_get_data(ret);
break;
case WAVE_GET_E:
len = wave_get_frames();
plhs[0] = mxCreateDoubleMatrix(len, 1, mxREAL);
ret = mxGetPr(plhs[0]);
if (len==0) break;
wave_get_energy(ret);
break;
case WAVE_GET_Z:
len = wave_get_frames();
plhs[0] = mxCreateDoubleMatrix(len, 1, mxREAL);
ret = mxGetPr(plhs[0]);
if (len==0) break;
wave_get_zcr(ret);
break;
default:
break;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -