
calling mex file with multiple entry point functions within it
    조회 수: 6 (최근 30일)
  
       이전 댓글 표시
    
Hello, 
I am trying to use mex file to speed up execution of my code. 
Specifically, I used the matlab coder to convert the matlab function into the mex file. 
Then, I called this mex file in my matlab code as following. 
  [EMAX_1, EMAX_2] = EMAX_solve_andrew_mex(temp_params,d,X0(k),E0(k),num_y(1+(k-1)*15:(k)*15));  
However, when I try to call this mex file, I get following errors. 
"Entry-point function name not specified. When calling MEX functions that have multiple entry-point functions,
 the first argument must be the name of the entry-point function to call. Follow this argument with the arguments that the named entry-point function requires."
I think the problem is that there are 2 functions inside of the EMAX_solve_andrew (which are "utility_andrew" and "log_wage_andrew", which I included as entry-point functions when I convert EMAX_solve_andrew. 
Can you please help me how to solve this issue? I tried to use mexfilename function as explained from following site, but was not able to follow it. 
https://www.mathworks.com/matlabcentral/answers/343776-how-do-i-use-a-mex-file-generated-from-matlab-coder-project-that-contains-multiple-entry-point-funct
Thank you. 
P.S. codegen folder is also created in the same folder. 
댓글 수: 0
답변 (1개)
  Anshika Chaurasia
    
 2020년 12월 29일
        
      편집: Anshika Chaurasia
    
 2020년 12월 29일
  
      Hi Dohun,
It is my understanding that you have generated EMAX_solve_andrew_mex that has entry point functions utility_andrew and log_wage_andrew.
Let's consider the MEX function, mySharedMex, that has entry-point functions ep1 and ep2.
To call ep1 with an input parameter u, enter:
mySharedMex('ep1',u) % mex_file('entry_point_function',parameters)
To call ep2 with input parameters v and x, enter:
mySharedMex('ep2',v,x)
If you don't pass entry-point function name like:
mySharedMex(u)
You will get error:

댓글 수: 0
참고 항목
카테고리
				Help Center 및 File Exchange에서 MATLAB Code Analysis에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

