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

📄 ne.c

📁 利用电磁场的源激发方法来计算光子晶体波导例如光子晶体光纤
💻 C
字号:
#include "mex.h"
#include "utils.h"

void mexFunction(int nOut, mxArray *pOut[], 
		 int nIn, const mxArray *pIn[])
{ 
  mxArray *dataA, *dataB;
  mxLogical value;

  if (mxIsClass(pIn[0], "pointer") && mxIsClass(pIn[1], "pointer"))
  {
    dataA = GetPointerData(pIn[0]);
    if (!GetPointerData(dataA))
      dataA = NULL;
    dataB = GetPointerData(pIn[1]);
    if (!GetPointerData(dataB))
      dataB = NULL;
  }
  else if (mxIsClass(pIn[0], "pointer") && mxIsDouble(pIn[1]) 
    && mxGetM(pIn[1])*mxGetN(pIn[1]) == 1 && !mxGetScalar(pIn[1]))
  {
    dataA = GetPointerData(GetPointerData(pIn[0]));
    dataB = NULL;
  }
  else if (mxIsClass(pIn[1], "pointer") && mxIsDouble(pIn[0]) 
    && mxGetM(pIn[0])*mxGetN(pIn[0]) == 1 && !mxGetScalar(pIn[0]))
  {
    dataA = NULL;
    dataB = GetPointerData(GetPointerData(pIn[1]));
  }
  else
    mexErrMsgTxt("Both inputs must be pointers or one of them is pointer and other is scalar 0 (= NULL)");

  value = dataA != dataB;

  pOut[0] = mxCreateLogicalScalar(value);
}


⌨️ 快捷键说明

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