#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";
	//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 dicrMat = "D:\\dicr_large.mat";
	//string wdMat = "D:\\wd_large.mat";

	MATFile* pwdMat, *pwd2Mat, *pdicrMat;
	mxArray* prhs[4];

	pwdMat = matOpen(wdMat.c_str(), "r");
	pwd2Mat = matOpen(wd2Mat.c_str(), "r");
	pdicrMat = matOpen(dicrMat.c_str(), "r");


	prhs[0] = matGetVariable(pwdMat, "wd"); //获取.mat文件里面名为matrixName的矩阵
	prhs[1] = matGetVariable(pwd2Mat, "wd2");
	// prhs[1] = mxCreateString("D:\\Twirls\\gat1\\literatures\\temp\\wd2s.txt");
	prhs[2] = matGetVariable(pdicrMat, "dicr");

	mxArray* plhs = (mxArray*)malloc(sizeof(mxArray*));

	mxArray** arg = &prhs[0];

	 mexFunction(1, &plhs, 3, arg);
	//mexFunction(0, 0, 0, 0);

	finish = clock();
	cout << "mexFunction Total time: " << (double)(finish - begin) / CLOCKS_PER_SEC << " s" << endl;

    return 0;
}
