35 lines
738 B
C++
35 lines
738 B
C++
|
|
#include <iostream>
|
|||
|
|
#include <string>
|
|||
|
|
#include <vector>
|
|||
|
|
#include "mex_func.h"
|
|||
|
|
#include "CommonLib/matlab_io.h"
|
|||
|
|
using namespace std;
|
|||
|
|
|
|||
|
|
int main(int argc, const char** argv)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
string matFile = "D:\\x_large.mat";
|
|||
|
|
//string matFile = "D:\\x.mat";
|
|||
|
|
|
|||
|
|
MATFile* pMatFile = nullptr;
|
|||
|
|
mxArray* prhs[1];
|
|||
|
|
int rowNum, colNum;
|
|||
|
|
double* matData;
|
|||
|
|
pMatFile = matOpen(matFile.c_str(), "r"); //打开.mat文件
|
|||
|
|
if (pMatFile == nullptr) {
|
|||
|
|
cout << "filePath is error!" << endl;
|
|||
|
|
return 1;
|
|||
|
|
}
|
|||
|
|
prhs[0] = matGetVariable(pMatFile, "x"); //获取.mat文件里面名为matrixName的矩阵
|
|||
|
|
|
|||
|
|
mxArray* plhs = (mxArray*)malloc(sizeof(mxArray*));
|
|||
|
|
|
|||
|
|
mxArray** arg = &prhs[0];
|
|||
|
|
|
|||
|
|
mexFunction(1, &plhs, 1, arg);
|
|||
|
|
//mexFunction(0, 0, 0, 0);
|
|||
|
|
|
|||
|
|
|
|||
|
|
return 0;
|
|||
|
|
}
|