#include #include #include #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"; //string matFile = "D:\\Twirls\\wd_small.mat"; //string matFile = "D:\\Twirls\\wd.mat"; clock_t begin = clock(), finish; //string wd2Mat = "D:\\wd2_5w.mat"; //string dicrMat = "D:\\dicr.mat"; //string wdMat = "D:\\wd.mat"; //string dicMat = "D:\\G_dc_large.mat"; //string wdMat = "D:\\wd_large.mat"; //MATFile* pwdMat, *pwd2Mat, *pdicMat; //mxArray* prhs[4]; //pwdMat = matOpen(wdMat.c_str(), "r"); // pwd2Mat = matOpen(wd2Mat.c_str(), "r"); //pdicMat = matOpen(dicMat.c_str(), "r"); // prhs[1] = mxCreateString("D:\\Twirls\\gat1\\literatures\\temp\\wd2s.txt"); // prhs[2] = matGetVariable(pdicrMat, "dicr"); /* IsWordInDic */ MATFile* pwdMat, * pdicMat; mxArray* plhs[4]; const mxArray* prhs[4]; int nlhs = 2, nrhs = 2; pwdMat = matOpen("D:\\wd_large.mat", "r"); pdicMat = matOpen("D:\\G_dc_large.mat", "r"); prhs[0] = matGetVariable(pwdMat, "wd"); //获取.mat文件里面名为matrixName的矩阵 prhs[1] = matGetVariable(pdicMat, "dc"); /* */ //MATFile* pMatX = matOpen("D:\\x_large.mat", "r"); //MATFile* pMatH = matOpen("D:\\h_large.mat", "r"); //prhs[0] = matGetVariable(pMatX, "x"); //prhs[1] = matGetVariable(pMatH, "h"); finish = clock(); cout << "Load Data time: " << (double)(finish - begin) / CLOCKS_PER_SEC << " s" << endl; mexFunctionWrap(nlhs, &plhs[0], nrhs, &prhs[0]); finish = clock(); cout << "mexFunction Total time: " << (double)(finish - begin) / CLOCKS_PER_SEC << " s" << endl; return 0; }