How to call a user defined Matlab from Java using matlabcontrol.jar

You must have any user-defined m-files on the MATLAB search path, just as if you were working normally inside MATLAB. I tested with the following example: C:\some\path\myfunc.m function myfunc() disp(‘hello from MYFUNC’) end HelloWorld.java import matlabcontrol.*; public class HelloWorld { public static void main(String[] args) throws MatlabConnectionException, MatlabInvocationException { // create proxy MatlabProxyFactoryOptions options = … Read more

Interoperating between Matlab and C#

Beginning with the R2009a release of MATLAB, .NET objects can be accessed from MATLAB: http://www.mathworks.com/help/techdoc/matlab_external/brpb5k6.html In older versions of MATLAB, it is possible to access .NET objects from MATLAB using CCW: http://www.mathworks.com/support/solutions/data/1-5U8HND.html?solution=1-5U8HND and the MATLAB engine from .NET: http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/matlab_external/f135590.html#f135616 You can also use the MATLAB Builder NE to wrap m-code into .NET assemblies. http://www.mathworks.com/products/netbuilder/