calling mex file with multiple entry point functions within it

13 visualizaciones (últimos 30 días)
dohun kim
dohun kim el 22 de Dic. de 2020
Editada: Anshika Chaurasia el 29 de Dic. de 2020
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.

Respuestas (1)

Anshika Chaurasia
Anshika Chaurasia el 29 de Dic. de 2020
Editada: Anshika Chaurasia el 29 de Dic. de 2020
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:
Refer to Generate Code for Multiple Entry-Point Functions document for more information.

Categorías

Más información sobre MATLAB Algorithm Acceleration en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by