Search code examples
javamatlabmixed-programming

How to run a MATLAB file (.m file) from java?


I am trying to figure out a way to run a .m file from java.

When the .m file is run it outputs a text file that I need to retrieve. I already have the code to retrieve the text file in java but I still cannot figure out how to start and run the .m file from java so that it outputs the file that I need. Any ideas?


Solution

  • I think MatlabControl is what you want. It's all described here: http://www.cs.virginia.edu/~whitehouse/matlab/JavaMatlab.html

    In essence, call

    MatlabControl.eval("yourfile.m");