MATLAB: Fsolve as a deployed DLL.

dllfsolvematlab coderMATLAB Compilernon-linear

Hello all ,
I am trying to create a dll in matlab to be able to solve non-linear equations. Is it possible to pass a set of equations (as string/char) into a dll that the will be solve by the function fsolve? I would to like to change the system of equations without having to recompile the dll.

Best Answer

No. Compiled MATLAB can never interpret runtime strings as MATLAB code.
https://www.mathworks.com/help/matlab/ref/str2func.html
You would need to essentially write your own interpreter of user provided strings, building up tree of calls to anonymous functions you had predefined. There are some cases in which that works well, but the more flexible you make it, the less efficient it gets, and the more likely you become to violating the license agreement against using MATLAB Compiler to effectively replicate the functionality of MATLAB.
Related Question