Well, Matlab Coder is able to convert .m files into mexfunctions under some restrictions.
For example, one can not call mex functions inside the .m file that is to be converted.
But is this restriction only meant for those mex functions that we don't have the source code?
That is to say, if we have the source code in C mex of a function, and the function is called inside a Matlab function, like this:
function result = fun() %#codegen
a = ...; %complex large-scale matrix operations
result = cFun(a);
end
as described above, cFun() can be written in C using mex to improve performance, but it might be better to write the matrix operations in Matlab instead of C.
Therefore, if we can supply the source code of cFun() and use Matlab Coder to convert fun() into mex, we would profit from both the convenience of matrix operations in Matlab, and the performance of some operations in C, or even OpenCL.
But is it possible?
Thanks!