dear @aklemm,
I did something similar passing argument from Matlab to ImageJ and get argument back from ImageJ to Matlab.
So to be clearer, I have a Matlab GUI that launch a ijm macro script in and then I get back some parameters from ImageJ and store/use them in Matlab.
I didn’t ImageJMATLAB plugin but I used the Miji http://imagej.net/Miji, http://bigwww.epfl.ch/sage/soft/mij/, https://it.mathworks.com/matlabcentral/fileexchange/47545mijrunningimagejandfijiwithinmatlab
You can read there how to implement Miji and use it in Matlab.
Trying to give some help to your question:

To pass argument to Fiji from Matlab:
I’ve created a .ijm script (.txt it’s also ok, but in IJ1 Macro language) and I getArguments in that script and IndexOf to get more than one argument.
Something like that:
args=getArgument();
image_path=substring(args, (indexOf(args,"image_path")+11), indexOf(args,"saving_path")1);
//print(image_path);
saving_path=substring(args, (indexOf(args,"saving_path")+12), indexOf(args,"R_median")1);
//print(saving_path);
R_median=parseFloat(substring(args, (indexOf(args,"R_median")+9), indexOf(args,"R_variance")1));
//print(R_median);
R_variance=parseFloat(substring(args, (indexOf(args,"R_variance")+11),indexOf(args,"thr_method")1));
//print(R_variance);
thr_method=substring(args, (indexOf(args,"thr_method")+11));
// **doSomethingWithTheseArguments**
Then I launch this script from Matlab with as @anon96376101 suggested with the runMacroFile
IJ=ij.IJ();
args=...
strcat('image_path=',image_path,' saving_path=',saving_path,' R_median=',R_median,...
' R_variance=',R_variance,' thr_method=',thr_method);
IJ.runMacroFile(java.lang.String(fullfile(macro_path,'WH_Miji_macro_RoiExtraction_setThr_auto.ijm'))...
,java.lang.String(args));
pay attention to have Miji working and have your IJM script in your macro path (1st argument of the runMacroFile function) and generally use java.lang.String to pass strings to it.
That way you can pass arguments to Fiji/ImageJ.

get outputs from Fiji/ImageJ to Matlab
To do it I use the log (where I’ve printed out something in a previous ImageJ macro launched in the way above mentioned) of ImageJ and get it using MIJ.getLog() and split more than arguments with spaces and some string functions.
and then launch another IJMacro1 macro in fiji to close the log.
// Matlab script to get the log and get the two thresholds used to do a segmentation
thresh=(char(MIJ.getLog()));
spaces = strfind(thresh,sprintf('\n'));
spaces = spaces(end1:end);
thresh_low=str2double(thresh(1:spaces(1)1));
thresh_upp=str2double(thresh(spaces(1):spaces(2)1));
// close th Log
IJ.runMacroFile(java.lang.String(fullfile(macro_path,'IJ_closeLog.txt'))...
,java.lang.String(args));
and the IJ_closeLog.txt script to close the log for ImageJ
if (isOpen("Log")) {
selectWindow("Log");
run("Close");
}
I don’t know if it’s the most elegant way, but I did it years ago… maybe now I would use a fullfledged script languange as @imagejan pointed out.
Hoping to being heplful,
have a nice day
Emanuele Martini