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

📄 myzerosuint8.c

📁 一个matlab处理海量数据的优化方法和源代码。
💻 C
字号:
#include "mex.h"

/*
 * myzerosuint8.c 
 *
 * constructs a M-by-N matrix of unsigned 8-bit integers
 *
 */

/* $Revision: 1.9.4.4 $ */

#define NDIMS 2

/* the gataway function */
void mexFunction( int nlhs, mxArray *plhs[],
                  int nrhs, const mxArray *prhs[] )
{
  int i, mrows, ncols, dims[2];
  unsigned char *pr;
  double *m, *n;

   /* Check for  2 arguments. */
  if (nrhs != 2) {
    mexErrMsgTxt("Two dimensions required.");
   }
  
  /* The dimensions must be a noncomplex scalar double.*/
  mrows = mxGetM(prhs[0]);
  ncols = mxGetN(prhs[0]);
  if (!mxIsDouble(prhs[0]) || mxIsComplex(prhs[0]) ||
      !(mrows == 1 && ncols == 1)) {
    mexErrMsgTxt("Inputs must be noncomplex scalar double.");
  }
  
  /* The dimensions must be a noncomplex scalar double.*/
  mrows = mxGetM(prhs[1]);
  ncols = mxGetN(prhs[1]);
  if (!mxIsDouble(prhs[1]) || mxIsComplex(prhs[1]) ||
      !(mrows == 1 && ncols == 1)) {
    mexErrMsgTxt("Inputs must be noncomplex scalar double.");
  }
  /* get dimensiosn for array to be generated*/

  dims[0]=(int) mxGetScalar(prhs[0]);
  dims[1]=(int) mxGetScalar(prhs[1]);
  
  /* create a M-by-N array of unsigned 8-bit integers */
  plhs[0] = mxCreateNumericArray(NDIMS,dims,mxUINT8_CLASS,mxREAL);

  /* Use the following code to make a fcuntion that returns non-zeros*/
  // pr = (unsigned char *)mxGetPr(plhs[0]);
  
  // for (i=0;i<(dims[0]*dims[1]);i++){ 
  //   pr[i]=1; 
  //}
}

⌨️ 快捷键说明

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