Borrar filtros
Borrar filtros

calling 2 custom function of the same name

4 visualizaciones (últimos 30 días)
julia
julia el 17 de Mzo. de 2011
I'd like to know if there is simple way to calling 2 custom functions of the same name. I have one MEX function, and now I need add the new functionality to it, but I do not want to touch any of the existing MEX function, and the interface to all the other users. I just want to write the same name function, add the new functionality, and than call the existing function. I'd like to know if there is any simple way to do it? Thanks.
Julia

Respuesta aceptada

Walter Roberson
Walter Roberson el 17 de Mzo. de 2011
Put the new interface in to directory that appears first on the path. Have the new interface loadlib() the previous instance and call it.
  6 comentarios
julia
julia el 18 de Mzo. de 2011
I am working from the Matlab level. Using loadliary(myFunc) in myFunc.m, I got: can not find the head file. I do not have the head file for it. I only have the .mexglx file. How can I load it dynamically? Thanks.
Walter Roberson
Walter Roberson el 18 de Mzo. de 2011
You have to create an appropriate .h file to match it, if you want to use loadlib() . You must already know the calling sequence in order to be able to call it without your addition -- or you must at least be able to reverse-engineer the calling sequence by knowing the standard mechanisms that Matlab uses when calling a mex routine.
You indicate that you do not want to touch the existing mex file, but do you have the source for it? If you do, then you can easily extract the calling sequence from there, and fairly readily build a .h file if you need it.

Iniciar sesión para comentar.

Más respuestas (1)

julia
julia el 22 de Mzo. de 2011
I soved the problem by using soft link and rename the linked file name that is pointing to the orginal function, and put the linked file in the src/ dir.

Categorías

Más información sobre Write C Functions Callable from MATLAB (MEX Files) en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by