首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

求助大侠们:labwindows与matlab的接口问题~~先谢过!!

求助大侠们:labwindows与matlab的接口问题~~先谢过!!

  我初学labwindows,现在有个课题是用labwindows做虚拟特征信号提取仪,要用到跟matlab接口,调用matlab程序,我的C文件编好以后,运行提示打开matlab有错误,下面是我的C程序和错误提示 (start部分的),请各位高手帮忙解决下 谢谢了~~~

int CVICALLBACK Start (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{  
    int  status=0;
    int i,strt,end;
    int strtt,endd;
    int great=0;
    double phase=0;
    double DecOrder1,DecOrder2;
    double PulseSignal[2048],SquareSignal[2048];
    double *matrixReal=NULL;
    double *matrixImag=NULL;
    unsigned dim1,dim2;
    int result=0;
 switch (event)
  {
  case EVENT_COMMIT:
  if (status==0)
  {
  strt=MLApp_NewDIMLApp(NULL,&hMatlab);/*启动matlab*/
  MinMaxMatlab(hMatlab,0);   /*使matlab窗口最小化*/
  status=1;
  }
  GetCtrlVal(panelHandle,PANEL_DecOrder1,&DecOrder1);
  GetCtrlVal(panelHandle,PANEL_DecOrder2,&DecOrder2);
  result=SendMatrix(hMatlab,"DecOrder1",(double*)&DecOrder1,NULL,1,1);
  
  if (result!=SUCCESS)/*把分解次数发送给matlab*/
  {MessagePopup("ERROR","ERROR IN SENDING DECORDER1 TO MATLAB");
  return 0;
  }
  result=SendMatrix(hMatlab,"DecOrder2",(double*)&DecOrder2,NULL,1,1);
  if(result!=SUCCESS)/*把终止频率发送给matlab*/
  {
  MessagePopup("ERROR","ERROR IN SENDING DECORDER2 TO MATLAB");
  return 0;
  }
  result=RunMatlabCommand(hMatab,"[initS,AppS,Pulse,Square]=WeakSigAbs(DecOrder1,DecOrder2);");
  result=GetMatrix(hMatlab,"initS",&matrixReal,&matrixImag,&dim1,&dim2);
  if(result!=SUCCESS)/* 获取消噪后的信号*/
  {
  MessagePopup("ERROR","ERROR IN GETTING INITS FROM MATLAB");
     return 0;
     }
     DeleteGraphPlot(panelHandle,PANEL_InitSignalGraph,-1,Val_IMMEDIATE_DRAW);
     /*清除原有图形,为后面的绘图做准备*/
     PlotY(panelHandle,PANEL_InitSignalGraph,matrixReal,dim2,VAL_DOUBLE,VAL_THIN_LINE,VAL_EMPTY_SQUARE,VAL_SOLID,1,VAL_RED);
     result=GetMatrix(hMatlab,"AppS",&matrixReal,&matrixImag,&dim1,&dim2);
     if (result!=SUCCESS)/*获取消噪后的信号*/
     {
      MessagePopup("ERROR","ERROR IN GETTING AppS from MATLAB");
      return 0;
      }
      DeleteGraphPlot(panelHandle,PANEL_AppSignalGraph,-1,VAL_IMMEDIATE_DRAW);/*清除原有图形,为后面的绘图做准备*/
      PlotY(panelHandle,PANEL_AppSignalGraph,matrixReal,dim2,VAL_DOUBLE,VAL_THIN_LINE,VAL_EMPTY_SQUARE,VAL_SOLID,1,VAL_RED);
      result=GetMatrix(hMatlab,"Pulse",&matrixReal,&matrixImag,&dim1,&dim2);
      if(result!=SUCCESS)/*获取消噪的信号*/
      {
      MessagePopup("ERROR","ERROR in getting pulse from MATLAB");
      return 0;
      }
      DeleteGraphPlot(panelHandle,PANEL_PulseGraph,-1,VAL_IMMEDIATE_DRAW);/*清除原有图形,为后面的绘图做准备*/
      PlotY(panelHandle,PANEL_PulseGraph,matrixReal,dim2,VAL_DOUBLE,VAL_THIN_LINE,VAL_EMPTY_SQUARE,VAL_SOLID,1,VAL_RED);
      result=GetMatrix(hMatlab,"Square",&matrixReal,&matrixImag,&dim1,&dim2);
      if (result!=SUCCESS)/* 获取消噪后的信号*/
      {
      MessagePopup("ERROR","ERROR in getting square from MATLAB");
      return 0;
      }
       DeleteGraphPlot(panelHandle,PANEL_SquareGraph,-1,VAL_IMMEDIATE_DRAW);/*清除原有图形,为后面的绘图做准备*/
       PlotY(panelHandle,PANEL_SquareGraph,matrixReal,dim2,VAL_DOUBLE,VAL_THIN_LINE,VAL_EMPTY_SQUARE,VAL_SOLID,1,VAL_BLUE);
       break;
       }
       return 0;
       }
  
 
   QuitUserInterface (0);
   break;
  }
 return 0;
}

错误提示:

 tq.c - 10 errors
  39, 37   Undeclared identifier 'hMatlab'.
  39, 44   Type error in argument 2 to `MLApp_NewDIMLApp'; found 'pointer to int'
           expected 'int'.
  39, 45   Insufficient number of arguments to `MLApp_NewDIMLApp'.
  40, 9    Missing prototype.
  45, 16   Missing prototype.
  45, 27   Undeclared identifier 'hMatlab'.
  47, 21   Undeclared identifier 'SUCCESS'.
  51, 16   Missing prototype.
  57, 16   Missing prototype.
  57, 33   Undeclared identifier 'hMatab'.

 

比较简单的错误

都是变量声名的问题

希望能够在不久的将来有次合作的机会  群:18994538 QQ: 364304745  个人主页:http://ldmcu.shangwusou.com/

麻烦版主告诉下要怎样修改好吗?

    连接不到matlab设计整个都没法完成 我刚学不太懂 帮帮忙 谢谢啦~~

返回列表