I am trying to get matlab and ImageJ work in a for loop in batch files.
The code is something like this
set iterationTimes=4
for /l %%i in (0,1,%iterationTimes%) do (
call matlab -nodesktop -nosplash -r "loop=%%i%%;"%stitchFile%
call %IJPath% -macro %JythonPath% %%arg%%
)
I specified the variable, the problem is ImageJ need to use the output of the matlab code, yet the batch seems execute ImageJ and Matlab in the same time...
I already used call to make the iteration variable i work, adding another call ahead of the two sentence would not help..
So how can I execute the matlab first and run ImageJ after matlab has finished running?
Thank you!!!!
The problem is you need to use matlabs wait option. You do not use cmd.exe's CALL
or START /WAIT
commands.
set iterationTimes=4
for /l %%i in (0,1,%iterationTimes%) do (
matlab -wait -nodesktop -nosplash -r "loop=%%i;"%stitchFile%
call %IJPath% -macro %JythonPath% %%arg%%
)