Simplest current way to run a Matlab script from ImageJ

Hi, one of the steps in my processing workflow involves processing data with Matlab.

Basically I have a “Matlab_process” folder with a bunch of .m files, one of them being a “batch.m” routine that calls a “process.m” script for every file within a folder, generating an output file for each (these are csv files).

Right now I have an ImageJ workflow upstream that generates the source folder with its csv files, run the batch Matlab routine manually to generate the new csv files, and run a downstream ImageJ workflow from these files.

Is there a way to automate this, i.e. call and execute the “batch.m” routine from ImageJ (assuming I have Matlab installed) and have the workflow continue to make the downstream processing, once Matlab has done its job? Something like running Matlab from the command line via ImageJ, but knowing when it is finished to process downstream?

Thank you for your help!

Dear christlet
I looked on this image.net and found this reference to running Matlab from Imagej. It looks like once you enable Imagej-MATLAB, you can run Matlab scripts from Imagej.
Here is some info from the site that I linked which talks about running .m files:

Presumably, you will be able to call the .m file during your workflow and have the workflow continue after that.