我初学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; } |