How to pass a user-defined function as a argument to mex file?
Show older comments
I am building a GUI for simulation of a control system. Users input a model in GUI, and I can obtain it as string type and then convert it into a function by str2fun. I am thinking about accelerating my control algorithm by cuda programming. As far as I know, GPU programming can be integrated with Matlab via cuda kernal which is a mex file(.cu). Since the mex file have only one entrance for passing arguments, i.e.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Thus I think it is hard to pass a function within the mexFunction. I was wondering if I can pass the function within the main function of cuda kernal, which begins with
__global__ void functionname(.....){
}
or if I can use head file (.h) to pass the function handle. Any suggestion is welcome. Thank you in advance.
Qun(a newbie of GPU programming)
Accepted Answer
More Answers (0)
Categories
Find more on GPU Computing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!