Is there a way to use MATLAB to set input state and epoch into GMAT and ask GMAT to propagate, then take the output, process it with MATLAB and feed it back into GMAT again for propagation?

One way I can think of is to use MATLAB to read/write to the input script and interpret the output from GMAT (do this as of as needed) then also use MATLAB to kick off the GMAT propagator.

For example,

MATLAB kick off GMAT command line with the script (Step 1) ------> wait until the GMAT process is done ------> MATLAB read the output from GMAT ------> MATLAB then use the output from GMAT to modify the input script (back to step 1)

Was just wondering if there a simpler way to do this? I mainly wants to use the GMAT's propagator.

Thanks.