想在mfc中打开mat文件
代码如下void CTHIRDDATA::OnOpenFile() 
{
CFileDialog dlgFileOpen(TRUE);
MATFile *pmatFile=NULL;
mxArray *pMxArray=NULL;

TCHAR lpstrFilename[MAX_PATH]="";
dlgFileOpen.m_ofn.lpstrFile = lpstrFilename;
TCHAR fileFilter[]="***.mat";
dlgFileOpen.m_ofn.lpstrFilter = fileFilter;
CString msg;
double *dMat1 = new double;
int m,n;
double *dMat2; if(dlgFileOpen.DoModal()==IDOK)


CString ddddd=dlgFileOpen.GetPathName();
pmatFile = matOpen(ddddd,"r"); pMxArray = matGetVariable(pmatFile,"z");

dMat1 = (double *)mxGetData(pMxArray);
msg.Format("%f",*dMat1);
AfxMessageBox(msg);
pMxArray = matGetVariable(pmatFile,"mat1");
m = mxGetM(pMxArray);
n = mxGetN(pMxArray);
msg.Format("M:%d,N:%d",m,n);
AfxMessageBox(msg);
dMat2 = new double[m*n];
dMat2 = (double *)mxGetData(pMxArray);
CString strTmp;
msg = "";
for(int i=0;i<m;i++)
{
for(int j=0;j<n;j++)
{
strTmp.Format("%f",dMat2[j*m+i]);
msg = msg + strTmp + "   ";
m_ListCtrl.InsertItem( j*m+i, LVCFMT_LEFT);
CString nID;
nID.Format("%d",j*m+i);
m_ListCtrl.SetItemText( j*m+i, 0, nID); 
m_ListCtrl.SetItemText( j*m+i, 1, strTmp); 
}
msg = msg + "/n";
}
AfxMessageBox(msg);
matClose(pmatFile);
mxFree(pMxArray);
// mxFree(pmatFile);
}
}可是出现连接错误
THIRDDATA.cpp
Linking...
THIRDDATA.obj : error LNK2001: unresolved external symbol _mxFree
THIRDDATA.obj : error LNK2001: unresolved external symbol _matClose
THIRDDATA.obj : error LNK2001: unresolved external symbol _mxGetN
THIRDDATA.obj : error LNK2001: unresolved external symbol _mxGetM
THIRDDATA.obj : error LNK2001: unresolved external symbol _mxGetData
THIRDDATA.obj : error LNK2001: unresolved external symbol _matGetVariable
THIRDDATA.obj : error LNK2001: unresolved external symbol _matOpen
Debug/3.exe : fatal error LNK1120: 7 unresolved externals
Error executing link.exe.尝试了网上说的修改配置,总是不行