Matlab function handle as a argument called by C?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
The MATLAB function x = fmincon(fun,x0,A,b) has a function handle @fun, when it compiles into a DLL, the function form is mlx- or mlf- as follow:
mlxFmincon(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[]);
mlfFmincon(int nargout, mxArray** X, mxArray** FVAL, mxArray** EXITFLAG, mxArray** OUTPUT, mxArray** LAMBDA, mxArray** GRAD, mxArray** HESSIAN, mxArray* FUN, mxArray* X_in1, mxArray* A, mxArray* B, mxArray* Aeq, mxArray* Beq, mxArray* LB, mxArray* UB, mxArray* NONLCON, mxArray* options, mxArray* varargin);
The problem is how can I call this function in the visual studio? Is it a way to use the function handle as a argument just like the function pointer in C? thanks.
0 Kommentare
Antworten (1)
Walter Roberson
am 29 Jul. 2012
You cannot directly call MATLAB functions, as function handles do not point to machine code. You need to ask the MATLAB Engine to evaluate the expression.
4 Kommentare
Walter Roberson
am 30 Jul. 2012
No.
You might, however, be able to pass the function handle of a mex function or of something you have loadlibrary()'d
Siehe auch
Kategorien
Mehr zu MATLAB Compiler finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!