I have a question related functions and their precedence for the following example:
Assume I have a function (calling it function_main) which calls several other functions (function_1…function_n). The called functions are mainly very generic, e.g. Matlab intrinsic functions. I have started to translate the functions for my use cases into mex-functions calling them function_1_mex etc.. The translation does not cover the generic implementation, but only the use case in function_main. For those I can Unit Test them against their original Matlab implementation for exactly that usage. But the function_main is still under development and I want to test if new use cases appear compared to the current status of the translation. Thus I want to add an additional Unit Test which does the following:
Mask function_1 with function_1_mex and call the original function_main (that would otherwise not call any of my mex functions and see if it fails compared to the Matlab-only code, thus showing me that I now miss other use cases. In pseudo C-code I'd like something like this:
#define function_1(params[]) function_1_mex(params[]) // masking original function_1 for one call of function_mainfunction_main();#undefined function_1
Is something comparable to that possible in Matlab? Maybe by changing the names of function_#_mex to function_# and changing the precedence for one call?
Best Answer